diff --git a/library/git-describe.cmake.in b/library/git-describe.cmake.in index 13fe4b208..d7d469fe8 100644 --- a/library/git-describe.cmake.in +++ b/library/git-describe.cmake.in @@ -1,10 +1,15 @@ # Generated from git-describe.cmake.in set(DFHACK_BUILD_ID "@DFHACK_BUILD_ID@") +if(NOT(EXISTS "${GIT_EXECUTABLE}")) + message(FATAL_ERROR "git-describe failed: could not find git at ${GIT_EXECUTABLE}") +endif() + execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=8 --long WORKING_DIRECTORY "${dfhack_SOURCE_DIR}" OUTPUT_VARIABLE DFHACK_GIT_DESCRIPTION - OUTPUT_STRIP_TRAILING_WHITESPACE) + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE DFHACK_GIT_DESCRIPTION_RESULT) execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD WORKING_DIRECTORY "${dfhack_SOURCE_DIR}" OUTPUT_VARIABLE DFHACK_GIT_COMMIT @@ -24,6 +29,10 @@ execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD OUTPUT_VARIABLE DFHACK_GIT_XML_COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE) +if(NOT(${DFHACK_GIT_DESCRIPTION_RESULT} EQUAL 0)) + message(FATAL_ERROR "git-describe failed: ${DFHACK_GIT_DESCRIPTION_RESULT}") +endif() + if(${DFHACK_GIT_TAGGED_RESULT} EQUAL 0) set(DFHACK_GIT_TAGGED TRUE) else()