mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 02:39:48 -06:00
cmComputeLinkInformation: Restore soname lookup for non-imported targets
In commit 7351d590ee (cmTarget: Add a way to represent imported shared
library stubs, 2023-07-17, v3.28.0-rc1~344^2) we accidentally stopped
passing the SONAME of a non-imported SHARED library to our runtime
search path ordering logic. Unfortunately I have not found a way to add
a test case for this, but it at least shouldn't regress existing tests
or those added by that commit.
This commit is contained in:
@@ -2363,20 +2363,21 @@ void cmComputeLinkInformation::AddLibraryRuntimeInfo(
|
||||
if (target->GetType() != cmStateEnums::SHARED_LIBRARY) {
|
||||
return;
|
||||
}
|
||||
auto const* info = target->GetImportInfo(this->Config);
|
||||
|
||||
// Skip targets that do not have a known runtime artifact.
|
||||
if (!target->HasKnownRuntimeArtifactLocation(this->Config)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to get the soname of the library. Only files with this name
|
||||
// could possibly conflict.
|
||||
const char* soname =
|
||||
(!info || info->SOName.empty()) ? nullptr : info->SOName.c_str();
|
||||
std::string soName = target->GetSOName(this->Config);
|
||||
const char* soname = soName.empty() ? nullptr : 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);
|
||||
}
|
||||
// Include this library in the runtime path ordering.
|
||||
this->OrderRuntimeSearchPath->AddRuntimeLibrary(fullPath, soname);
|
||||
if (this->LinkWithRuntimePath) {
|
||||
this->OrderLinkerSearchPath->AddRuntimeLibrary(fullPath, soname);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1098,7 +1098,6 @@ private:
|
||||
std::string SharedDeps;
|
||||
};
|
||||
|
||||
friend cmComputeLinkInformation;
|
||||
using ImportInfoMapType = std::map<std::string, ImportInfo>;
|
||||
mutable ImportInfoMapType ImportInfoMap;
|
||||
void ComputeImportInfo(std::string const& desired_config,
|
||||
|
||||
Reference in New Issue
Block a user