]> granicus.if.org Git - clang/commitdiff
CMake: try to actually fix the regexes for setting HOST_LINK_VERSION this time (PR21268)
authorHans Wennborg <hans@hanshq.net>
Thu, 4 Dec 2014 01:59:58 +0000 (01:59 +0000)
committerHans Wennborg <hans@hanshq.net>
Thu, 4 Dec 2014 01:59:58 +0000 (01:59 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223333 91177308-0d34-0410-b5e6-96231b3b80d8

CMakeLists.txt

index 35d8d690edcbe26f2f54655cc1c52d2231226d46..b868b56c41de3fc77bb8cbb943dfff3cadad5213 100644 (file)
@@ -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}")