From 4d8a116849ad63cc32cfe69da0dd1c5b15284d33 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Fri, 9 Oct 2020 02:54:36 +1100 Subject: [PATCH] [all] set the working directory for git versioning commands --- version.cmake | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/version.cmake b/version.cmake index 01eb816e..9e089b06 100644 --- a/version.cmake +++ b/version.cmake @@ -1,17 +1,14 @@ -execute_process(COMMAND git describe --always --long --abbrev=10 --tags - OUTPUT_VARIABLE GIT_REV - ERROR_QUIET) +execute_process( + COMMAND git describe --always --long --abbrev=10 --tags + WORKING_DIRECTORY "${PROJECT_TOP}" + OUTPUT_VARIABLE GIT_REV + ERROR_QUIET) if (NOT "${GIT_REV}" STREQUAL "") execute_process( COMMAND bash -c "git diff --quiet --exit-code || echo +" + WORKING_DIRECTORY "${PROJECT_TOP}" OUTPUT_VARIABLE GIT_DIFF) - execute_process( - COMMAND git describe --exact-match --tags - OUTPUT_VARIABLE GIT_TAG ERROR_QUIET) - execute_process( - COMMAND git rev-parse --abbrev-ref HEAD - OUTPUT_VARIABLE GIT_BRANCH) string(STRIP "${GIT_REV}" GIT_REV) endif()