summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeLinkInformation.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-01-08 14:47:05 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-01-08 14:47:15 (GMT)
commita3f76a4e4dc15997f22306b002fbc452af1259a6 (patch)
tree4111bd85d836501c9e41fc4b505659be2df46fbc /Source/cmComputeLinkInformation.cxx
parent2cc792ba29668f3d8d4a2a03ff79baba947ec3c2 (diff)
parent2c6ec6de1521b1e82f2bd5ac3324f6953ac31f4d (diff)
downloadCMake-a3f76a4e4dc15997f22306b002fbc452af1259a6.zip
CMake-a3f76a4e4dc15997f22306b002fbc452af1259a6.tar.gz
CMake-a3f76a4e4dc15997f22306b002fbc452af1259a6.tar.bz2
Merge topic 'link-stubs-transitively'
2c6ec6de15 Link to transitive dependencies on stub libraries only on some linkers dd4a6dff92 Link explicitly to private transitive dependencies on stub libraries 5f1bbdb3b3 Tests: Enable RunCMake.RuntimePath test on more platforms Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !9050
Diffstat (limited to 'Source/cmComputeLinkInformation.cxx')
-rw-r--r--Source/cmComputeLinkInformation.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index e7bef68..40eb902 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1331,7 +1331,17 @@ void cmComputeLinkInformation::AddSharedDepItem(LinkEntry const& entry)
}
// If in linking mode, just link to the shared library.
- if (this->SharedDependencyMode == SharedDepModeLink) {
+ if (this->SharedDependencyMode == SharedDepModeLink ||
+ // For an imported shared library without a known runtime artifact,
+ // such as a CUDA stub, a library file named with the real soname
+ // may not be available at all, so '-rpath-link' cannot help linkers
+ // find it to satisfy '--no-allow-shlib-undefined' recursively.
+ // Pass this dependency to the linker explicitly just in case.
+ // If the linker also uses '--as-needed' behavior, this will not
+ // add an unnecessary direct dependency.
+ (tgt && tgt->IsImported() &&
+ !tgt->HasKnownRuntimeArtifactLocation(this->Config) &&
+ this->Target->LinkerEnforcesNoAllowShLibUndefined(this->Config))) {
this->AddItem(entry);
return;
}