diff options
author | Brad King <brad.king@kitware.com> | 2023-07-19 14:55:20 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-07-19 14:55:30 (GMT) |
commit | b0054dd65c1d69a437abe85d27e704326884a9c2 (patch) | |
tree | 8e49628c253769984e756ff71e260777da8c9852 /Source/cmComputeLinkInformation.cxx | |
parent | ee6335f75f63f90f73583ed6ec430769d905a354 (diff) | |
parent | 7351d590ee6a846ed0f2bd4793384a33bf49ea0d (diff) | |
download | CMake-b0054dd65c1d69a437abe85d27e704326884a9c2.zip CMake-b0054dd65c1d69a437abe85d27e704326884a9c2.tar.gz CMake-b0054dd65c1d69a437abe85d27e704326884a9c2.tar.bz2 |
Merge topic 'imported-implib-only'
7351d590ee cmTarget: Add a way to represent imported shared library stubs
83574a4772 GeneratorExpression: Expand testing of imported location resolution
b75ff51947 Testing: Map RelWithDebInfo config in GeneratorExpression test
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Jason Juang <jasjuang@gmail.com>
Merge-request: !8582
Diffstat (limited to 'Source/cmComputeLinkInformation.cxx')
-rw-r--r-- | Source/cmComputeLinkInformation.cxx | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 04e4fc7..f4bb8b1 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -2241,16 +2241,20 @@ void cmComputeLinkInformation::AddLibraryRuntimeInfo( if (target->GetType() != cmStateEnums::SHARED_LIBRARY) { return; } + auto const* info = target->GetImportInfo(this->Config); // Try to get the soname of the library. Only files with this name // could possibly conflict. - std::string soName = target->GetSOName(this->Config); - const char* soname = soName.empty() ? nullptr : soName.c_str(); - - // Include this library in the runtime path ordering. - this->OrderRuntimeSearchPath->AddRuntimeLibrary(fullPath, soname); - if (this->LinkWithRuntimePath) { - this->OrderLinkerSearchPath->AddRuntimeLibrary(fullPath, soname); + const char* soname = + (!info || info->SOName.empty()) ? nullptr : info->SOName.c_str(); + + // If this shared library has a known runtime artifact (IMPORTED_LOCATION), + // include its location in the runtime path ordering. + if (!info || !info->Location.empty()) { + this->OrderRuntimeSearchPath->AddRuntimeLibrary(fullPath, soname); + if (this->LinkWithRuntimePath) { + this->OrderLinkerSearchPath->AddRuntimeLibrary(fullPath, soname); + } } } |