Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong project version #220

Open
panicgh opened this issue Mar 25, 2023 · 2 comments
Open

Wrong project version #220

panicgh opened this issue Mar 25, 2023 · 2 comments
Labels
Milestone

Comments

@panicgh
Copy link

panicgh commented Mar 25, 2023

Building libnitrokey with -DADD_GIT_INFO=OFF causes it to fallback to the project version specified in the CMakeLists.txt. Apparently this version was not incremented for the 3.8 release and later, i.e. it is still displayed as version 3.7.0 in nitrokey-app, some log output etc.

project(libnitrokey LANGUAGES C CXX VERSION 3.7.0)

@szszszsz
Copy link
Member

Good spot! This certainly should be corrected for the next release.
FWIW there are no implementation differences between 3.8 and 3.7 AFAIR.

@szszszsz szszszsz added the bug label Mar 27, 2023
@szszszsz szszszsz added this to the v3.9 milestone Mar 27, 2023
@jjakob
Copy link

jjakob commented May 15, 2023

I also patch it to allow setting PROJECT_VERSION_GIT as cmake cache variable from CLI, '-DPROJECT_VERSION_GIT="v3.8-10-ge4b2b91' as I build from a source snapshot with no git available during build.
This patch doesn't change any behavior if PROJECT_VERSION_GIT is not set in cache so I think it could be applied upstream.

From 3d58ea51b9922d529c6402c5cd10849c0b8f6ba3 Mon Sep 17 00:00:00 2001
From: Jernej Jakob <jernej.jakob@gmail.com>
Date: Sun, 14 May 2023 23:52:11 +0200
Subject: [PATCH 1/2] CMakeLists.txt: allow setting PROJECT_VERSION_GIT from
 CLI

---
 CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 246923d..b604b8a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -142,7 +142,10 @@ ENDIF()
 # 2. If git is not installed, PROJECT_VERSION_GIT_RETURN_CODE
 #    will contain the string 'No such file or directory'
 # Hence fallback to PROJECT_VERSION when the return code is NOT 0.
-IF((NOT ${ADD_GIT_INFO}) OR (NOT ${PROJECT_VERSION_GIT_RETURN_CODE} STREQUAL "0"))
+IF(((NOT ${ADD_GIT_INFO})
+               OR (NOT ${PROJECT_VERSION_GIT_RETURN_CODE} STREQUAL "0")
+               )
+               AND (NOT PROJECT_VERSION_GIT))
        MESSAGE(STATUS "Setting fallback Git library version")
        SET(PROJECT_VERSION_GIT "v${PROJECT_VERSION}")
 ENDIF()
--
2.39.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants