From 9a2a3278766724cc638ab6792da3046245e175be Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Sat, 22 Jun 2024 11:50:06 -0400 Subject: [PATCH] {cmake} Better handling of git revision in REVISION_ID Only add it if it exits & indicate that it is git. This also leaves the cmake version in the ID in case the git tag doesn't exist or doesn't contain it. --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b0cd39..4f2cbc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,7 +117,10 @@ option( E57_RELEASE_LTO "Compile release library with link-time optimization" ON ######################################################################################### -set( REVISION_ID "${PROJECT_NAME}-${GIT_LATEST_TAG}-${${PROJECT_NAME}_BUILD_TAG}" ) +set( REVISION_ID "${PROJECT_NAME}-${PROJECT_VERSION}-${${PROJECT_NAME}_BUILD_TAG}" ) +if ( GIT_LATEST_TAG ) + set( REVISION_ID "${REVISION_ID} (git ${GIT_LATEST_TAG})" ) +endif() message( STATUS "[${PROJECT_NAME}] Revision ID: ${REVISION_ID}" ) # Target