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

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