aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2019-08-12 10:18:56 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2019-08-12 10:18:56 +0200
commit28832f06f22a8e24aab4079f1f33159547704ae3 (patch)
tree7688dbded6741f7e02571eec42b68767caec0b6f
parent0cf995e79221fa2e88801fb910eba8aacf54d58a (diff)
parent2034fe79dfaf7bb3cc9f5aa1cd6c56f46897fc96 (diff)
downloadlibnitrokey-28832f06f22a8e24aab4079f1f33159547704ae3.tar.gz
libnitrokey-28832f06f22a8e24aab4079f1f33159547704ae3.tar.bz2
Merge branch 'pr_161'
Fix for CMAKE's version getter Fixes #161
-rw-r--r--CMakeLists.txt9
1 files changed, 8 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6d59430..1169e94 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -129,7 +129,14 @@ execute_process(
ERROR_QUIET
)
ENDIF()
-IF((NOT ${ADD_GIT_INFO}) OR (${PROJECT_VERSION_GIT_RETURN_CODE}))
+# the version.h generation logic is tricky in a number of ways:
+# 1. git describe on a release tarball will always fail with
+# a non-zero return code, usually 128
+# 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"))
+ MESSAGE(STATUS "Setting fallback Git library version")
SET(PROJECT_VERSION_GIT "v${PROJECT_VERSION}")
ENDIF()
MESSAGE(STATUS "Setting Git library version to: " ${PROJECT_VERSION_GIT} )