Sync git version generation

This commit is contained in:
Marvin W 2019-12-18 02:38:35 +01:00
parent dce47d506d
commit 9fe8450571
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A

View file

@ -71,8 +71,9 @@ function(_compute_version_from_git)
set(VERSION_IS_RELEASE 1)
else ()
set(VERSION_IS_RELEASE 0)
if (git_describe MATCHES "g([0-9a-f]+)$")
set(VERSION_COMMIT_HASH "${CMAKE_MATCH_1}")
if (git_describe MATCHES "-([0-9]+)-g([0-9a-f]+)$")
set(VERSION_TAG_OFFSET "${CMAKE_MATCH_1}")
set(VERSION_COMMIT_HASH "${CMAKE_MATCH_2}")
endif ()
execute_process(
COMMAND "${GIT_EXECUTABLE}" show --format=%cd --date=format:%Y%m%d -s
@ -89,7 +90,7 @@ function(_compute_version_from_git)
set(VERSION_COMMIT_DATE "${git_time}")
endif ()
if (NOT VERSION_IS_RELEASE)
set(VERSION_SUFFIX ".git${VERSION_COMMIT_DATE}.${VERSION_COMMIT_HASH}")
set(VERSION_SUFFIX "~git${VERSION_TAG_OFFSET}.${VERSION_COMMIT_DATE}.${VERSION_COMMIT_HASH}")
else (NOT VERSION_IS_RELEASE)
set(VERSION_SUFFIX "")
endif (NOT VERSION_IS_RELEASE)