From 303dcd083a4a6e1cbf84bd02d735b53a5bdc495d Mon Sep 17 00:00:00 2001 From: Nikola Ducak Date: Tue, 26 Dec 2023 18:05:49 +0100 Subject: [PATCH] fix: display-correct-version-in-help-string --- .github/workflows/release.yml | 4 ++-- CMakeLists.txt | 7 ++++++- source/version.hpp.in | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a54aca1..d7d7a5d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,7 +51,7 @@ jobs: - name: Build run: | mkdir build && cd build - cmake .. && make + cmake -DCAPS_LOG_VERSION="${{ needs.create-release.outputs.version }}" .. && make - name: Archive and Upload binaries to release run: | @@ -71,7 +71,7 @@ jobs: - name: Build for MacOS run: | mkdir build-macos && cd build-macos - cmake .. && make + cmake -DCAPS_LOG_VERSION="${{ needs.create-release.outputs.version }}" .. && make - name: Archive and Upload MacOS binaries to release run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 8458133..5df1559 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,13 @@ cmake_minimum_required(VERSION 3.14) +# If version number is not provided, just use a dummy +if(NOT CAPS_LOG_VERSION) + set(CAPS_LOG_VERSION "development") +endif() + +# Project setup project(caps-log LANGUAGES CXX - VERSION 1.0.0 ) set(CMAKE_CXX_STANDARD 17) diff --git a/source/version.hpp.in b/source/version.hpp.in index 8c5af9b..6e9a3c4 100644 --- a/source/version.hpp.in +++ b/source/version.hpp.in @@ -3,5 +3,5 @@ // Propagating PROJECT_VERSION cmake variable to caps log source code to be used where needed #ifndef CAPS_LOG_VERSION # undef CAPS_LOG_VERSION -# define CAPS_LOG_VERSION "@PROJECT_VERSION@" +# define CAPS_LOG_VERSION "@CAPS_LOG_VERSION@" #endif