Changed: Allow to put a "revision" file in root directory if .hg directory is not present

This commit is contained in:
kervala 2013-09-06 08:44:57 +02:00
parent ff444f42fa
commit 3c3e25d523

View file

@ -19,6 +19,7 @@ IF(SOURCE_DIR)
SET(SOURCE_DIR ${ROOT_DIR})
ENDIF(NOT SOURCE_DIR AND ROOT_DIR)
ELSE(SOURCE_DIR)
SET(SOURCE_DIR ${CMAKE_SOURCE_DIR})
SET(ROOT_DIR ${CMAKE_SOURCE_DIR})
ENDIF(SOURCE_DIR)
@ -57,6 +58,15 @@ IF(EXISTS "${ROOT_DIR}/.hg/")
ENDIF(MERCURIAL_FOUND)
ENDIF(EXISTS "${ROOT_DIR}/.hg/")
# if processing exported sources, use "revision" file if exists
IF(SOURCE_DIR AND NOT DEFINED REVISION)
SET(REVISION_FILE ${SOURCE_DIR}/revision)
IF(EXISTS ${REVISION_FILE})
FILE(STRINGS ${REVISION_FILE} REVISION LIMIT_COUNT 1)
MESSAGE(STATUS "Read revision ${REVISION} from file")
ENDIF(EXISTS ${REVISION_FILE})
ENDIF(SOURCE_DIR AND NOT DEFINED REVISION)
IF(SOURCE_DIR AND DEFINED REVISION)
IF(EXISTS ${SOURCE_DIR}/revision.h.in)
MESSAGE(STATUS "Revision: ${REVISION}")