summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Darwin-Clang.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-12-05 16:49:13 (GMT)
committerBrad King <brad.king@kitware.com>2012-12-11 20:15:51 (GMT)
commit2dd67c7ea095957d557d2934a67baacdf8a82d7b (patch)
tree3207ea2e40eeb01e0f84538a04ead6193ff5120a /Modules/Platform/Darwin-Clang.cmake
parentba58d0c06fd8576844a5722930531a95d00c2003 (diff)
downloadCMake-2dd67c7ea095957d557d2934a67baacdf8a82d7b.zip
CMake-2dd67c7ea095957d557d2934a67baacdf8a82d7b.tar.gz
CMake-2dd67c7ea095957d557d2934a67baacdf8a82d7b.tar.bz2
OS X: Detect implicit link directories on modern toolchains
We detect the implicit link directories for the toolchain by adding a flag to get verbose output from the compiler front-end while linking the ABI detection binary. Newer OS X toolchains based on Clang do not add the implicit link directories with -L options to their internal invocation of "ld". Instead they use a linker that comes with the toolchain and is already configured with the proper directories. Add the "-Wl,-v" option to ask "ld" to print its implicit directories. It displays them in a block such as: Library search paths: /... Parse this block to extract the implicit link directories. While at it, remove the checks introduced by commit efaf335b (Skip implicit link information on Xcode, 2009-07-23) and commit 5195a664 (Skip implicit link info for multiple OS X archs, 2009-09-22). Discard the non-system link directories added by Xcode. Discard all detected implicit libraries in the multi-architecture case but keep the directories. The directories are still useful without the libraries just to suppress addition of explicit -L options for them.
Diffstat (limited to 'Modules/Platform/Darwin-Clang.cmake')
-rw-r--r--Modules/Platform/Darwin-Clang.cmake1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/Platform/Darwin-Clang.cmake b/Modules/Platform/Darwin-Clang.cmake
index de7a856..528873c 100644
--- a/Modules/Platform/Darwin-Clang.cmake
+++ b/Modules/Platform/Darwin-Clang.cmake
@@ -19,6 +19,7 @@ endif()
set(__DARWIN_COMPILER_CLANG 1)
macro(__darwin_compiler_clang lang)
+ set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot")