diff options
author | Brad King <brad.king@kitware.com> | 2012-12-05 18:46:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-12-11 20:15:52 (GMT) |
commit | cc676c3a08019b17433931a9287d9cd8b0ccf2f2 (patch) | |
tree | 8dd39816b0c86d71ae2a3dadd384c740bd1da730 /Tests/CMakeTests | |
parent | 2dd67c7ea095957d557d2934a67baacdf8a82d7b (diff) | |
download | CMake-cc676c3a08019b17433931a9287d9cd8b0ccf2f2.zip CMake-cc676c3a08019b17433931a9287d9cd8b0ccf2f2.tar.gz CMake-cc676c3a08019b17433931a9287d9cd8b0ccf2f2.tar.bz2 |
OS X: Detect implicit linker framework search paths
Previously we hard-coded a list of implicit framework directories but
did not account for CMAKE_OSX_SYSROOT or for changes to the list across
OS X versions. Instead we should automatically detect the framework
directories for the active toolchain.
The parent commit added the "-Wl,-v" option to ask "ld" to print its
implicit directories. It displays a block such as:
Framework search paths:
/...
Parse this block to extract the list of framework directories.
Detection may fail on toolchains that do not list their framework
directories, such as older OS X linkers. Always treat the paths
<sdk>/Library/Frameworks
<sdk>/System/Library/Frameworks
<sdk>/Network/Library/Frameworks # Older OS X only
/System/Library/Frameworks
as implicit. Note that /System/Library/Frameworks should always be
considered implicit so that frameworks CMake finds there will not
override the SDK copies.
Diffstat (limited to 'Tests/CMakeTests')
-rw-r--r-- | Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in index 0296304..31488c0 100644 --- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in +++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in @@ -120,6 +120,7 @@ Framework search paths: /System/Library/Frameworks/") set(mac_i686_gcc_Wlv_libs "") set(mac_i686_gcc_Wlv_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib") +set(mac_i686_gcc_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks") list(APPEND platforms mac_i686_gcc_Wlv) # gcc -arch i686 dummy.c -v @@ -146,6 +147,7 @@ Framework search paths: /System/Library/Frameworks/") set(mac_i686_g++_Wlv_libs "stdc++") set(mac_i686_g++_Wlv_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib") +set(mac_i686_g++_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks") list(APPEND platforms mac_i686_g++_Wlv) # g++ -arch i686 dummy.cxx -v @@ -169,6 +171,7 @@ Framework search paths: /System/Library/Frameworks/") set(mac_i686_gfortran_Wlv_libs "gfortranbegin;gfortran") set(mac_i686_gfortran_Wlv_dirs "/usr/local/lib/gcc/i386-apple-darwin9.7.0/4.4.1;/usr/local/lib;/usr/lib") +set(mac_i686_gfortran_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks") list(APPEND platforms mac_i686_gfortran_Wlv) # gfortran dummy.f -v @@ -195,6 +198,7 @@ Framework search paths: /System/Library/Frameworks/") set(mac_ppc_gcc_Wlv_libs "") set(mac_ppc_gcc_Wlv_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib") +set(mac_ppc_gcc_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks") list(APPEND platforms mac_ppc_gcc_Wlv) # gcc -arch ppc dummy.c -v @@ -221,6 +225,7 @@ Framework search paths: /System/Library/Frameworks/") set(mac_ppc_g++_Wlv_libs "stdc++") set(mac_ppc_g++_Wlv_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib") +set(mac_ppc_g++_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks") list(APPEND platforms mac_ppc_g++_Wlv) # g++ -arch ppc dummy.cxx -v @@ -499,10 +504,10 @@ list(APPEND platforms msys_g77) # Test parsing for all above examples. foreach(p IN LISTS platforms) - cmake_parse_implicit_link_info("${${p}_text}" libs dirs log "${${p}_obj_regex}") + cmake_parse_implicit_link_info("${${p}_text}" libs dirs fwks log "${${p}_obj_regex}") - foreach(v libs dirs) - if(NOT "${${v}}" STREQUAL "${${p}_${v}}") + foreach(v libs dirs fwks) + if(DEFINED "${p}_${v}" AND NOT "${${v}}" STREQUAL "${${p}_${v}}") message(FATAL_ERROR "cmake_parse_implicit_link_info failed\n" "Expected '${p}' implicit ${v}\n" |