Fixed: Strip version strings only when successful

feature/version-resources
kaetemi 6 years ago
parent 84bb09c130
commit 7657d3e177

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

Loading…
Cancel
Save