1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

cmake: work with CMake < 2.8.5

CMake versions 2.8.4 and earlier were giving this error since r146323:
"string end index: -1 is out of range 0 - 6"

Passing -1 as the length of the desired substring was a new feature
added in CMake 2.8.5:
http://www.cmake.org/Bug/view.php?id=10740

llvm-svn: 146372
This commit is contained in:
Dylan Noblesmith 2011-12-12 13:06:25 +00:00
parent 2bedf185c9
commit f91dda4a1a

View File

@ -30,7 +30,9 @@ function(add_version_info_from_vcs VERS)
OUTPUT_VARIABLE git_output)
if( git_result EQUAL 0 )
string(REGEX MATCH r[0-9]+ git_svn_rev ${git_output})
string(SUBSTRING "${git_svn_rev}" 1 -1 git_svn_rev_number)
string(LENGTH "${git_svn_rev}" rev_length)
math(EXPR rev_length "${rev_length}-1")
string(SUBSTRING "${git_svn_rev}" 1 ${rev_length} git_svn_rev_number)
set(SVN_REVISION ${git_svn_rev_number} PARENT_SCOPE)
set(git_svn_rev "-svn-${git_svn_rev}")