From 7f98f1e30819b82cb015a4fb25755a24dfbe02db Mon Sep 17 00:00:00 2001 From: Jaye Evins Date: Wed, 16 Apr 2025 12:43:23 -0400 Subject: [PATCH] Allow for an external build directory when gathering version information with git --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7563dad..50dec4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ set (WEBSITE "glabels.org") set (BUG_WEBSITE "https://github.com/j-evins/glabels-qt/issues") execute_process( + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND git symbolic-ref --short HEAD RESULT_VARIABLE BRANCH_VALID OUTPUT_VARIABLE BRANCH @@ -28,6 +29,7 @@ if (NOT ${BRANCH_VALID} STREQUAL "0") endif () execute_process( + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND git rev-list --count ${BRANCH} RESULT_VARIABLE COMMIT_COUNT_VALID OUTPUT_VARIABLE COMMIT_COUNT @@ -38,6 +40,7 @@ if (NOT ${COMMIT_COUNT_VALID} STREQUAL "0") endif () execute_process( + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND git log -1 --format=%h RESULT_VARIABLE COMMIT_HASH_VALID OUTPUT_VARIABLE COMMIT_HASH @@ -48,6 +51,7 @@ if (NOT ${COMMIT_HASH_VALID} STREQUAL "0") endif () execute_process( + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND git log -1 --format=%cd --date=short RESULT_VARIABLE COMMIT_DATE_VALID OUTPUT_VARIABLE COMMIT_DATE