Skip to content

Commit 0d0200c

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. (cherry picked from commit 05a165b)
1 parent c10fcd3 commit 0d0200c

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
@@ -615,15 +615,17 @@ if(CMAKE_GENERATOR MATCHES "Ninja" AND
615615
endif()
616616

617617
if(CMAKE_HOST_APPLE AND APPLE)
618-
if(NOT CMAKE_XCRUN)
619-
find_program(CMAKE_XCRUN NAMES xcrun)
620-
endif()
621-
if(CMAKE_XCRUN)
622-
execute_process(COMMAND ${CMAKE_XCRUN} -find ld
623-
OUTPUT_VARIABLE LD64_EXECUTABLE
624-
OUTPUT_STRIP_TRAILING_WHITESPACE)
625-
else()
626-
find_program(LD64_EXECUTABLE NAMES ld DOC "The ld64 linker")
618+
if(NOT LD64_EXECUTABLE)
619+
if(NOT CMAKE_XCRUN)
620+
find_program(CMAKE_XCRUN NAMES xcrun)
621+
endif()
622+
if(CMAKE_XCRUN)
623+
execute_process(COMMAND ${CMAKE_XCRUN} -find ld
624+
OUTPUT_VARIABLE LD64_EXECUTABLE
625+
OUTPUT_STRIP_TRAILING_WHITESPACE)
626+
else()
627+
find_program(LD64_EXECUTABLE NAMES ld DOC "The ld64 linker")
628+
endif()
627629
endif()
628630

629631
if(LD64_EXECUTABLE)

0 commit comments

Comments
 (0)