aboutsummaryrefslogtreecommitdiff
path: root/cmake/ComputeVersion.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/ComputeVersion.cmake')
-rw-r--r--cmake/ComputeVersion.cmake7
1 files changed, 4 insertions, 3 deletions
diff --git a/cmake/ComputeVersion.cmake b/cmake/ComputeVersion.cmake
index 3a962671..9ea38aaa 100644
--- a/cmake/ComputeVersion.cmake
+++ b/cmake/ComputeVersion.cmake
@@ -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)