summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-07-14 11:14:30 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-07-14 11:15:11 (GMT)
commit8c6cce27ca74d28e6370d1a424fc11c1d3686eb9 (patch)
tree9f33f2423eaf52facffeab25f0ed454e81f2ac65
parent2ef6ad0136d2df954fffe6ccce52b1636a0e5771 (diff)
parentd9af90504f7d2a0ac90eeedf12148647b3feb27b (diff)
downloadCMake-8c6cce27ca74d28e6370d1a424fc11c1d3686eb9.zip
CMake-8c6cce27ca74d28e6370d1a424fc11c1d3686eb9.tar.gz
CMake-8c6cce27ca74d28e6370d1a424fc11c1d3686eb9.tar.bz2
Merge topic 'macos-11-file-GET_RUNTIME_DEPENDENCIES' into release-3.18
d9af90504f Tests: Update file(G_R_D) test to make system library optional c51400033c file: Update GET_RUNTIME_DEPENDENCIES for macOS 11 dylib cache Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Kyle Edwards <kyle.edwards@kitware.com> Merge-request: !4998
-rw-r--r--Source/cmBinUtilsMacOSMachOLinker.cxx15
-rw-r--r--Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake26
2 files changed, 28 insertions, 13 deletions
diff --git a/Source/cmBinUtilsMacOSMachOLinker.cxx b/Source/cmBinUtilsMacOSMachOLinker.cxx
index 98250b1..0f47146 100644
--- a/Source/cmBinUtilsMacOSMachOLinker.cxx
+++ b/Source/cmBinUtilsMacOSMachOLinker.cxx
@@ -14,6 +14,18 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
+namespace {
+bool IsMissingSystemDylib(std::string const& path)
+{
+ // Starting on macOS 11, the dynamic loader has a builtin cache of
+ // system-provided dylib files that do not exist on the filesystem.
+ // Tell our caller that these are expected to be missing.
+ return ((cmHasLiteralPrefix(path, "/System/Library/") ||
+ cmHasLiteralPrefix(path, "/usr/lib/")) &&
+ !cmSystemTools::PathExists(path));
+}
+}
+
cmBinUtilsMacOSMachOLinker::cmBinUtilsMacOSMachOLinker(
cmRuntimeDependencyArchive* archive)
: cmBinUtilsLinker(archive)
@@ -82,7 +94,8 @@ bool cmBinUtilsMacOSMachOLinker::GetFileDependencies(
return false;
}
if (resolved) {
- if (!this->Archive->IsPostExcluded(path)) {
+ if (!this->Archive->IsPostExcluded(path) &&
+ !IsMissingSystemDylib(path)) {
auto filename = cmSystemTools::GetFilenameName(path);
bool unique;
this->Archive->AddResolvedPath(filename, path, unique);
diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake
index 7f68398..e6f2623 100644
--- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake
+++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake
@@ -16,7 +16,15 @@ in file:
endif()
endfunction()
-set(_check
+function(set_with_libsystem var)
+ set(_tmp "${ARGN}")
+ if(EXISTS "/usr/lib/libSystem.B.dylib")
+ list(APPEND _tmp [[/usr/lib/libSystem\.B\.dylib]])
+ endif()
+ set("${var}" "${_tmp}" PARENT_SCOPE)
+endfunction()
+
+set_with_libsystem(_check
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/bin/../lib/executable_path/libexecutable_path\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/bin/../lib/rpath_executable_path/librpath_executable_path\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/libtestlib\.dylib]]
@@ -24,7 +32,6 @@ set(_check
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/../rpath/librpath\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/libnormal\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/rpath_loader_path/librpath_loader_path\.dylib]]
- [[/usr/lib/libSystem\.B\.dylib]]
)
check_contents(deps/deps1.txt "^${_check}$")
@@ -37,13 +44,12 @@ set(_check
)
check_contents(deps/udeps1.txt "^${_check}$")
-set(_check
+set_with_libsystem(_check
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/libtestlib\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/loader_path/libloader_path\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/../rpath/librpath\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/libnormal\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/rpath_loader_path/librpath_loader_path\.dylib]]
- [[/usr/lib/libSystem\.B\.dylib]]
)
check_contents(deps/deps2.txt "^${_check}$")
@@ -60,13 +66,12 @@ set(_check
)
check_contents(deps/udeps2.txt "^${_check}$")
-set(_check
+set_with_libsystem(_check
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/libtestlib\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/loader_path/libloader_path\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/../rpath/librpath\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/libnormal\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/rpath_loader_path/librpath_loader_path\.dylib]]
- [[/usr/lib/libSystem\.B\.dylib]]
)
check_contents(deps/deps3.txt "^${_check}$")
@@ -83,7 +88,7 @@ set(_check
)
check_contents(deps/udeps3.txt "^${_check}$")
-set(_check
+set_with_libsystem(_check
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/bin/../lib/executable_path/libexecutable_path\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/bin/../lib/rpath_executable_path/librpath_executable_path\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/libtestlib\.dylib]]
@@ -91,7 +96,6 @@ set(_check
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/../rpath/librpath\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/libnormal\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/rpath_loader_path/librpath_loader_path\.dylib]]
- [[/usr/lib/libSystem\.B\.dylib]]
)
check_contents(deps/deps4.txt "^${_check}$")
@@ -104,14 +108,13 @@ set(_check
)
check_contents(deps/udeps4.txt "^${_check}$")
-set(_check
+set_with_libsystem(_check
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/bundle_executable/bin/../lib/executable_path_bundle/libexecutable_path_bundle\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/libtestlib\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/loader_path/libloader_path\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/../rpath/librpath\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/libnormal\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/rpath_loader_path/librpath_loader_path\.dylib]]
- [[/usr/lib/libSystem\.B\.dylib]]
)
check_contents(deps/deps5.txt "^${_check}$")
@@ -125,14 +128,13 @@ set(_check
)
check_contents(deps/udeps5.txt "^${_check}$")
-set(_check
+set_with_libsystem(_check
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/bundle_executable/bin/../lib/executable_path_bundle/libexecutable_path_bundle\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/libtestlib\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/loader_path/libloader_path\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/../rpath/librpath\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/libnormal\.dylib]]
[[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/rpath_loader_path/librpath_loader_path\.dylib]]
- [[/usr/lib/libSystem\.B\.dylib]]
)
check_contents(deps/deps6.txt "^${_check}$")