Don't append the git revision if tagged to match the current version

This commit is contained in:
Tim Angus 2025-10-08 13:35:32 +01:00
parent 1c1590d6c0
commit dbc451190a

View File

@ -51,14 +51,23 @@ if(NOT PRODUCT_VERSION)
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
execute_process(
COMMAND git show -s --pretty=format:%h
COMMAND git describe --tags --exact-match
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_REV
OUTPUT_VARIABLE GIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
if(GIT_REV)
set(PRODUCT_VERSION "${PRODUCT_VERSION}_g${GIT_REV}")
if(NOT GIT_TAG STREQUAL "${PRODUCT_VERSION}")
execute_process(
COMMAND git show -s --pretty=format:%h
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_REV
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
if(GIT_REV)
set(PRODUCT_VERSION "${PRODUCT_VERSION}_g${GIT_REV}")
endif()
endif()
endif()
endif()