Prevent crash on Windows due to no revision from Git or Mercurial found.
This commit is contained in:
parent
f37b991c14
commit
69c8be03d9
1 changed files with 101 additions and 86 deletions
|
@ -72,6 +72,16 @@ IF(EXISTS "${ROOT_DIR}/.hg/")
|
|||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(EXISTS "${ROOT_DIR}/.git/")
|
||||
FIND_PACKAGE(Git)
|
||||
|
||||
IF(GIT_FOUND)
|
||||
Git_WC_INFO(${ROOT_DIR} ER)
|
||||
SET(REVISION ${ER_WC_REVISION})
|
||||
SET(CHANGESET ${ER_WC_CHANGESET})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# if processing exported sources, use "revision" file if exists
|
||||
IF(SOURCE_DIR AND NOT DEFINED REVISION)
|
||||
SET(REVISION_FILE ${SOURCE_DIR}/revision)
|
||||
|
@ -81,6 +91,11 @@ IF(SOURCE_DIR AND NOT DEFINED REVISION)
|
|||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Prevent crash if no revision from git or mercurial found
|
||||
IF(NOT DEFINED REVISION)
|
||||
SET(REVISION 0)
|
||||
ENDIF()
|
||||
|
||||
IF(DEFINED REVISION)
|
||||
MESSAGE(STATUS "Found revision ${REVISION}")
|
||||
ENDIF()
|
||||
|
|
Loading…
Reference in a new issue