[llvm] r276781 - [CMAKE] Find ld64 using xcrun
Bruno Cardoso Lopes via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 26 11:09:24 PDT 2016
Author: bruno
Date: Tue Jul 26 13:09:23 2016
New Revision: 276781
URL: http://llvm.org/viewvc/llvm-project?rev=276781&view=rev
Log:
[CMAKE] Find ld64 using xcrun
Given similar reasons from r276710, ld64 scrubs DYLD_* environment if
called from the shim executable /usr/bin/ld.
Add support for finding ld64 via xcrun.
This is needed in order to get LIT to have the full path to the ld4
executable.
Differential Revision: https://reviews.llvm.org/D22791
rdar://problem/24300926
Modified:
llvm/trunk/cmake/config-ix.cmake
Modified: llvm/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=276781&r1=276780&r2=276781&view=diff
==============================================================================
--- llvm/trunk/cmake/config-ix.cmake (original)
+++ llvm/trunk/cmake/config-ix.cmake Tue Jul 26 13:09:23 2016
@@ -548,8 +548,19 @@ find_program(GOLD_EXECUTABLE NAMES ${LLV
set(LLVM_BINUTILS_INCDIR "" CACHE PATH
"PATH to binutils/include containing plugin-api.h for gold plugin.")
-if(APPLE)
- find_program(LD64_EXECUTABLE NAMES ld DOC "The ld64 linker")
+if(CMAKE_HOST_APPLE AND APPLE)
+ if(CMAKE_XCRUN)
+ execute_process(COMMAND ${CMAKE_XCRUN} -find ld
+ OUTPUT_VARIABLE LD64_EXECUTABLE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ else()
+ find_program(LD64_EXECUTABLE NAMES ld DOC "The ld64 linker")
+ endif()
+
+ if(LD64_EXECUTABLE)
+ set(LD64_EXECUTABLE ${LD64_EXECUTABLE} CACHE PATH "ld64 executable")
+ message(STATUS "Found ld64 - ${LD64_EXECUTABLE}")
+ endif()
endif()
include(FindOCaml)
More information about the llvm-commits
mailing list