Skip to content

Commit 633e3da

Browse files
committed
[CMake] Print the autodetected host linker version
There's no easy way to find out what the autodetected version is, but sometimes it may be useful to confirm that the right version is being used. Print it as CMake status message. Differential Revision: https://reviews.llvm.org/D85362
1 parent 1c1ffa6 commit 633e3da

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

clang/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -424,15 +424,15 @@ if (APPLE)
424424
RESULT_VARIABLE HAD_ERROR
425425
OUTPUT_VARIABLE LD_V_OUTPUT
426426
)
427-
if (NOT HAD_ERROR)
428-
if ("${LD_V_OUTPUT}" MATCHES ".*ld64-([0-9.]+).*")
429-
string(REGEX REPLACE ".*ld64-([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
430-
elseif ("${LD_V_OUTPUT}" MATCHES "[^0-9]*([0-9.]+).*")
431-
string(REGEX REPLACE "[^0-9]*([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
432-
endif()
433-
else()
427+
if (HAD_ERROR)
434428
message(FATAL_ERROR "${CMAKE_LINKER} failed with status ${HAD_ERROR}")
435429
endif()
430+
if ("${LD_V_OUTPUT}" MATCHES ".*ld64-([0-9.]+).*")
431+
string(REGEX REPLACE ".*ld64-([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
432+
elseif ("${LD_V_OUTPUT}" MATCHES "[^0-9]*([0-9.]+).*")
433+
string(REGEX REPLACE "[^0-9]*([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
434+
endif()
435+
message(STATUS "Host linker version: ${HOST_LINK_VERSION}")
436436
endif()
437437

438438
include(CMakeParseArguments)

0 commit comments

Comments
 (0)