From 9fe8450571e49aaf376d07b379968c575bc0445c Mon Sep 17 00:00:00 2001 From: Marvin W Date: Wed, 18 Dec 2019 02:38:35 +0100 Subject: [PATCH] Sync git version generation --- cmake/ComputeVersion.cmake | 7 ++++--- 1 file 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)