From 8f2f8a2ce2449f35836d86ba6dd189bbd6c57e72 Mon Sep 17 00:00:00 2001 From: Haowen Liu Date: Sun, 16 Jun 2024 03:38:13 +0000 Subject: [PATCH] Take version from VERSION file This enables sharing of version between meson and CMake --- .github/workflows/cmake.yml | 2 ++ CMakeLists.txt | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 869aa47..86d9ee0 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -9,6 +9,7 @@ on: - "CMakeLists.txt" - "CMakePresets.json" - ".github/workflows/cmake.yml" + - "VERSION" pull_request: branches: [main] paths: @@ -17,6 +18,7 @@ on: - "CMakeLists.txt" - "CMakePresets.json" - ".github/workflows/cmake.yml" + - "VERSION" # Allows you to run this workflow manually from the Actions tab workflow_dispatch: diff --git a/CMakeLists.txt b/CMakeLists.txt index 832aa67..7855eb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,10 @@ cmake_minimum_required(VERSION 3.22) +file(READ VERSION VERSION) +string(STRIP ${VERSION} VERSION_STRIPPED) project( cps-config LANGUAGES CXX - VERSION 0.01 + VERSION ${VERSION_STRIPPED} ) add_subdirectory(src)