diff options
author | Brad King <brad.king@kitware.com> | 2024-01-08 14:47:05 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2024-01-08 14:47:15 (GMT) |
commit | a3f76a4e4dc15997f22306b002fbc452af1259a6 (patch) | |
tree | 4111bd85d836501c9e41fc4b505659be2df46fbc /Source/cmComputeLinkInformation.cxx | |
parent | 2cc792ba29668f3d8d4a2a03ff79baba947ec3c2 (diff) | |
parent | 2c6ec6de1521b1e82f2bd5ac3324f6953ac31f4d (diff) | |
download | CMake-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.cxx | 12 |
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; } |