Fix error condition in cmake's git_get_changeset_id

floating-point
Julius Michaelis 2012-12-08 00:24:00 +01:00
parent 8c3e78cee4
commit 2a68766856
1 changed files with 8 additions and 1 deletions

View File

@ -23,7 +23,14 @@ function(git_get_changeset_id VAR)
LIMIT_COUNT 1
REGEX "node: [0-9a-f]+"
)
string(SUBSTRING "${C4REVISION}" 6 12 C4REVISION)
string(LENGTH "${C4REVISION}" revlength)
if(revlength LESS 18)
set(C4REVISION "unknown")
message(WARNING "Could not retrieve git revision. Please set GIT_EXECUTABLE!")
else()
string(SUBSTRING "${C4REVISION}" 6 12 C4REVISION)
endif()
unset(revlength)
endif()
if(WORKDIR_DIRTY)
set(C4REVISION "${C4REVISION}+")