Skip to content

Commit 05a165b

Browse files
committed
[llvm/cmake/config-ix.cmake] If LD64_EXECUTABLE is already set, avoid the need to look up ld64
This provides option to set the `LD64_EXECUTABLE` variable to a path at CMake configure time directly.
1 parent 0e18d5e commit 05a165b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

llvm/cmake/config-ix.cmake

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -622,15 +622,17 @@ if(CMAKE_GENERATOR MATCHES "Ninja" AND
622622
endif()
623623

624624
if(CMAKE_HOST_APPLE AND APPLE)
625-
if(NOT CMAKE_XCRUN)
626-
find_program(CMAKE_XCRUN NAMES xcrun)
627-
endif()
628-
if(CMAKE_XCRUN)
629-
execute_process(COMMAND ${CMAKE_XCRUN} -find ld
630-
OUTPUT_VARIABLE LD64_EXECUTABLE
631-
OUTPUT_STRIP_TRAILING_WHITESPACE)
632-
else()
633-
find_program(LD64_EXECUTABLE NAMES ld DOC "The ld64 linker")
625+
if(NOT LD64_EXECUTABLE)
626+
if(NOT CMAKE_XCRUN)
627+
find_program(CMAKE_XCRUN NAMES xcrun)
628+
endif()
629+
if(CMAKE_XCRUN)
630+
execute_process(COMMAND ${CMAKE_XCRUN} -find ld
631+
OUTPUT_VARIABLE LD64_EXECUTABLE
632+
OUTPUT_STRIP_TRAILING_WHITESPACE)
633+
else()
634+
find_program(LD64_EXECUTABLE NAMES ld DOC "The ld64 linker")
635+
endif()
634636
endif()
635637

636638
if(LD64_EXECUTABLE)

0 commit comments

Comments
 (0)