mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-24 07:08:38 -05:00
macOS: Restore RPATH entry for libraries linked from /usr/local/lib
Since commit 7b19531291 (macOS: Do not pass any SDK/-isysroot to
compilers by default, 2024-11-06, v4.0.0-rc1~511^2) our default
invocation of compilers targeting macOS no longer passes `-isysroot`.
Without that, Xcode's compilers search `-L/usr/local/lib` by default
even though the macOS dynamic loader does not. Since `/usr/local/lib`
is not a fully-implemented implicit link directory, exclude it from our
detected `CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES` so that our generators
do not suppress `RPATH` entries for dependencies in that directory.
Fixes: #26867
This commit is contained in:
@@ -292,4 +292,11 @@ if(NOT CMAKE_OSX_SYSROOT)
|
||||
RESULT_VARIABLE _result
|
||||
)
|
||||
unset(_sdk_macosx)
|
||||
|
||||
list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES_EXCLUDE
|
||||
# Without -isysroot, some compiler drivers implicitly pass -L/usr/local/lib
|
||||
# to the linker. Since the macOS dynamic loader does not search it by
|
||||
# default, it is not a fully-implemented implicit link directory.
|
||||
/usr/local/lib
|
||||
)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user