Allow for an external build directory when gathering version information with git

This commit is contained in:
Jaye Evins
2025-04-16 12:43:23 -04:00
parent f8efe3aafa
commit 7f98f1e308
+4
View File
@@ -18,6 +18,7 @@ set (WEBSITE "glabels.org")
set (BUG_WEBSITE "https://github.com/j-evins/glabels-qt/issues") set (BUG_WEBSITE "https://github.com/j-evins/glabels-qt/issues")
execute_process( execute_process(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND git symbolic-ref --short HEAD COMMAND git symbolic-ref --short HEAD
RESULT_VARIABLE BRANCH_VALID RESULT_VARIABLE BRANCH_VALID
OUTPUT_VARIABLE BRANCH OUTPUT_VARIABLE BRANCH
@@ -28,6 +29,7 @@ if (NOT ${BRANCH_VALID} STREQUAL "0")
endif () endif ()
execute_process( execute_process(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND git rev-list --count ${BRANCH} COMMAND git rev-list --count ${BRANCH}
RESULT_VARIABLE COMMIT_COUNT_VALID RESULT_VARIABLE COMMIT_COUNT_VALID
OUTPUT_VARIABLE COMMIT_COUNT OUTPUT_VARIABLE COMMIT_COUNT
@@ -38,6 +40,7 @@ if (NOT ${COMMIT_COUNT_VALID} STREQUAL "0")
endif () endif ()
execute_process( execute_process(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND git log -1 --format=%h COMMAND git log -1 --format=%h
RESULT_VARIABLE COMMIT_HASH_VALID RESULT_VARIABLE COMMIT_HASH_VALID
OUTPUT_VARIABLE COMMIT_HASH OUTPUT_VARIABLE COMMIT_HASH
@@ -48,6 +51,7 @@ if (NOT ${COMMIT_HASH_VALID} STREQUAL "0")
endif () endif ()
execute_process( execute_process(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND git log -1 --format=%cd --date=short COMMAND git log -1 --format=%cd --date=short
RESULT_VARIABLE COMMIT_DATE_VALID RESULT_VARIABLE COMMIT_DATE_VALID
OUTPUT_VARIABLE COMMIT_DATE OUTPUT_VARIABLE COMMIT_DATE