[llvm-commits] [llvm] r146372 - /llvm/trunk/cmake/modules/VersionFromVCS.cmake

Dylan Noblesmith nobled at dreamwidth.org
Mon Dec 12 05:06:25 PST 2011


Author: nobled
Date: Mon Dec 12 07:06:25 2011
New Revision: 146372

URL: http://llvm.org/viewvc/llvm-project?rev=146372&view=rev
Log:
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

Modified:
    llvm/trunk/cmake/modules/VersionFromVCS.cmake

Modified: llvm/trunk/cmake/modules/VersionFromVCS.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/VersionFromVCS.cmake?rev=146372&r1=146371&r2=146372&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/VersionFromVCS.cmake (original)
+++ llvm/trunk/cmake/modules/VersionFromVCS.cmake Mon Dec 12 07:06:25 2011
@@ -30,7 +30,9 @@
                       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}")
 





More information about the llvm-commits mailing list