diff --git a/code/CMakeModules/GetRevision.cmake b/code/CMakeModules/GetRevision.cmake index 469f7375a..f18b662e1 100644 --- a/code/CMakeModules/GetRevision.cmake +++ b/code/CMakeModules/GetRevision.cmake @@ -82,6 +82,8 @@ IF(EXISTS "${ROOT_DIR}/.git/") OUTPUT_VARIABLE REVISION) IF(NOT ${git_exit_code} EQUAL 0) MESSAGE(WARNING "git rev-list failed, unable to include version.") + ELSE() + STRING(STRIP ${REVISION} REVISION) ENDIF() EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} rev-parse --short=8 HEAD WORKING_DIRECTORY ${ROOT_DIR} @@ -89,6 +91,8 @@ IF(EXISTS "${ROOT_DIR}/.git/") OUTPUT_VARIABLE CHANGESET) IF(NOT ${git_exit_code} EQUAL 0) MESSAGE(WARNING "git rev-parse failed, unable to include version.") + ELSE() + STRING(STRIP ${CHANGESET} CHANGESET) ENDIF() EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD WORKING_DIRECTORY ${ROOT_DIR} @@ -96,6 +100,8 @@ IF(EXISTS "${ROOT_DIR}/.git/") OUTPUT_VARIABLE BRANCH) IF(NOT ${git_exit_code} EQUAL 0) MESSAGE(WARNING "git rev-parse failed, unable to include git branch.") + ELSE() + STRING(STRIP ${BRANCH} BRANCH) ENDIF() EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} describe WORKING_DIRECTORY ${ROOT_DIR} @@ -103,11 +109,9 @@ IF(EXISTS "${ROOT_DIR}/.git/") OUTPUT_VARIABLE DESCRIBE) IF(NOT ${git_exit_code} EQUAL 0) MESSAGE(WARNING "git rev-parse failed, unable to include git branch.") + ELSE() + STRING(STRIP ${DESCRIBE} DESCRIBE) ENDIF() - STRING(STRIP ${REVISION} REVISION) - STRING(STRIP ${CHANGESET} CHANGESET) - STRING(STRIP ${BRANCH} BRANCH) - STRING(STRIP ${DESCRIBE} DESCRIBE) ENDIF() ENDIF()