r223333 - CMake: try to actually fix the regexes for setting HOST_LINK_VERSION this time (PR21268)

Hans Wennborg hans at hanshq.net
Wed Dec 3 17:59:59 PST 2014


Author: hans
Date: Wed Dec  3 19:59:58 2014
New Revision: 223333

URL: http://llvm.org/viewvc/llvm-project?rev=223333&view=rev
Log:
CMake: try to actually fix the regexes for setting HOST_LINK_VERSION this time (PR21268)

The regex should not accept an empty version number.

The previous attempt at r223106 failed, and the build was still erroring:

  CMake Error at tools/clang/CMakeLists.txt:269 (string):
    string sub-command REGEX, mode REPLACE regex "[^0-9]*([0-9.]*).*" matched
    an empty string.

Modified:
    cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=223333&r1=223332&r2=223333&view=diff
==============================================================================
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Wed Dec  3 19:59:58 2014
@@ -263,10 +263,10 @@ if (APPLE)
     OUTPUT_VARIABLE LD_V_OUTPUT
   )
   if (NOT HAD_ERROR)
-    if ("${LD_V_OUTPUT}" MATCHES ".*ld64.*")
-      string(REGEX REPLACE ".*ld64-([0-9.]*).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
-    elseif ("${LD_V_OUTPUT}" MATCHES "[^0-9]*([0-9.]*).*")
-      string(REGEX REPLACE "[^0-9]*([0-9.]*).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
+    if ("${LD_V_OUTPUT}" MATCHES ".*ld64-([0-9.]+).*")
+      string(REGEX REPLACE ".*ld64-([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
+    elseif ("${LD_V_OUTPUT}" MATCHES "[^0-9]*([0-9.]+).*")
+      string(REGEX REPLACE "[^0-9]*([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
     endif()
   else()
     message(FATAL_ERROR "${CMAKE_LINKER} failed with status ${HAD_ERROR}")





More information about the cfe-commits mailing list