summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2020-05-22 16:32:15 (GMT)
committerSaleem Abdulrasool <compnerd@compnerd.org>2020-05-31 03:32:38 (GMT)
commit444dbd40def8a6d991879f9ed9499f13bc7ffb12 (patch)
tree61d52a6cc2d2aacfaf844915ce17f7864f691b10
parent67dd68765700bbd6a981700c04f45b28cdc85587 (diff)
downloadCMake-444dbd40def8a6d991879f9ed9499f13bc7ffb12.zip
CMake-444dbd40def8a6d991879f9ed9499f13bc7ffb12.tar.gz
CMake-444dbd40def8a6d991879f9ed9499f13bc7ffb12.tar.bz2
Darwin: honour `CMAKE_OSX_SYSROOT` more faithfully
The libraries in the SDK should be given precedence over the system libraries. Check for the default library search path (in default order) of `/usr/lib` and `/usr/local/lib` and use these as system prefix paths for libraries when performing the link step against a specified SDK.
-rw-r--r--Modules/Platform/Darwin.cmake26
1 files changed, 21 insertions, 5 deletions
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index 0a4d4e1..c6de3b0 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -42,6 +42,7 @@ endif()
set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
+set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".tbd" ".so")
set(CMAKE_SHARED_MODULE_PREFIX "lib")
set(CMAKE_SHARED_MODULE_SUFFIX ".so")
set(CMAKE_MODULE_EXISTS 1)
@@ -156,6 +157,13 @@ if(_CMAKE_OSX_SYSROOT_PATH)
break()
endif()
endforeach()
+
+ if(EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/lib)
+ list(INSERT CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES 0 ${_CMAKE_OSX_SYSROOT_PATH}/usr/lib)
+ endif()
+ if(EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/local/lib)
+ list(INSERT CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES 0 ${_CMAKE_OSX_SYSROOT_PATH}/usr/local/lib)
+ endif()
endif()
if (OSX_DEVELOPER_ROOT AND EXISTS "${OSX_DEVELOPER_ROOT}/Library/Frameworks")
list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH
@@ -208,11 +216,19 @@ set(CMAKE_SYSTEM_APPBUNDLE_PATH
unset(_apps_paths)
include(Platform/UnixPaths)
-if(_CMAKE_OSX_SYSROOT_PATH AND EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${_CMAKE_OSX_SYSROOT_PATH}/usr)
- foreach(lang C CXX OBJC OBJCXX Swift)
- list(APPEND _CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
- endforeach()
+if(_CMAKE_OSX_SYSROOT_PATH)
+ if(EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
+ list(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 ${_CMAKE_OSX_SYSROOT_PATH}/usr)
+ foreach(lang C CXX OBJC OBJCXX Swift)
+ list(APPEND _CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
+ endforeach()
+ endif()
+ if(EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/local/include)
+ list(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 ${_CMAKE_OSX_SYSROOT_PATH}/usr/local)
+ foreach(lang C CXX OBJC OBJCXX Swift)
+ list(APPEND _CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${_CMAKE_OSX_SYSROOT_PATH}/usr/local/include)
+ endforeach()
+ endif()
endif()
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
/sw # Fink