Simplify, and fix build failure when mercurial isn't installed

--HG--
branch : Mac64
master
Cinder 2014-05-24 23:14:55 -06:00
parent 8fd6092917
commit ee0573dff5
1 changed files with 5 additions and 9 deletions

View File

@ -16,9 +16,8 @@ if (NOT DEFINED VIEWER_SHORT_VERSION) # will be true in indra/, false in indra/n
else (DEFINED ENV{revision})
find_program(MERCURIAL hg)
find_program(WORDCOUNT wc)
find_program(SED sed)
if (DEFINED MERCURIAL AND DEFINED WORDCOUNT AND DEFINED SED)
if (DEFINED MERCURIAL AND DEFINED SED)
execute_process(
# <FS:TS> FIRE-11737: Reverting to old revisions shows tip in build string
# This command gets the revision number of the current
@ -30,23 +29,20 @@ if (NOT DEFINED VIEWER_SHORT_VERSION) # will be true in indra/, false in indra/n
#COMMAND ${WORDCOUNT} -l
#COMMAND ${SED} "s/ //g"
COMMAND ${MERCURIAL} identify -n
COMMAND ${SED} "s/+//" # [CR] Strip off any + from the revision number
OUTPUT_VARIABLE VIEWER_VERSION_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# <FS:TS> Now strip off a trailing + if it's there, showing that
# there are uncommitted changes.
string (REGEX REPLACE "\\+$" "" VIEWER_VERSION_REVISION ${VIEWER_VERSION_REVISION})
# </FS:TS> FIRE-11737
if ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$")
message("Revision (from hg) ${VIEWER_VERSION_REVISION}")
else ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$")
message("Revision not set (repository not found?); using 0")
set(VIEWER_VERSION_REVISION 0 )
endif ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$")
else (DEFINED MERCURIAL AND DEFINED WORDCOUNT AND DEFINED SED)
message("Revision not set: 'hg', 'wc' or 'sed' not found; using 0")
else (DEFINED MERCURIAL AND DEFINED SED)
message("Revision not set: 'hg' or 'sed' not found; using 0")
set(VIEWER_VERSION_REVISION 0)
endif (DEFINED MERCURIAL AND DEFINED WORDCOUNT AND DEFINED SED)
endif (DEFINED MERCURIAL AND DEFINED SED)
endif (DEFINED ENV{revision})
message("Building '${VIEWER_CHANNEL}' Version ${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}")
else ( EXISTS ${VIEWER_VERSION_BASE_FILE} )