Prevent crash on Windows due to no revision from Git or Mercurial found.

This commit is contained in:
Sit Melai 2018-04-07 17:20:10 +02:00
parent f37b991c14
commit 69c8be03d9

View file

@ -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()