build: only manipulate out if getting the timestamp was successful

This fixes an issue seen in #1548, though the real problem is something
different.
This commit is contained in:
John Szakmeister 2014-12-03 04:10:52 -05:00
parent 143833872b
commit cf1939aab3

View File

@ -158,11 +158,12 @@ function(git_timestamp _var)
OUTPUT_VARIABLE out OUTPUT_VARIABLE out
ERROR_QUIET ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0) if(res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
string(REGEX REPLACE "[-\" :]" "" out ${out}) string(REGEX REPLACE "[-\" :]" "" out ${out})
string(SUBSTRING ${out} 0 12 out) string(SUBSTRING ${out} 0 12 out)
else()
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} ${out} PARENT_SCOPE) set(${_var} ${out} PARENT_SCOPE)
endfunction() endfunction()