Fixed: Strip version strings only when successful
This commit is contained in:
parent
84bb09c130
commit
7657d3e177
1 changed files with 8 additions and 4 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in a new issue