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)
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,13 +109,11 @@ 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.")
ENDIF()
STRING(STRIP ${REVISION} REVISION)
STRING(STRIP ${CHANGESET} CHANGESET)
STRING(STRIP ${BRANCH} BRANCH)
ELSE()
STRING(STRIP ${DESCRIBE} DESCRIBE)
ENDIF()
ENDIF()
ENDIF()
# if processing exported sources, use "revision" file if exists
IF(SOURCE_DIR AND NOT DEFINED REVISION)

Loading…
Cancel
Save