cmBinUtilsLinuxELFLinker: Cache ldconfig results

Running GetLDConfigPaths in every ScanDependencies is expensive.
This commit is contained in:
Atılhan Emre Dursunoğlu
2023-09-18 14:49:48 +03:00
parent 0846414ba2
commit f173ca21ca

View File

@@ -73,6 +73,9 @@ bool cmBinUtilsLinuxELFLinker::Prepare()
if (ldConfigTool == "ldconfig") {
this->LDConfigTool =
cm::make_unique<cmLDConfigLDConfigTool>(this->Archive);
if (!this->LDConfigTool->GetLDConfigPaths(this->LDConfigPaths)) {
return false;
}
} else {
std::ostringstream e;
e << "Invalid value for CMAKE_LDCONFIG_TOOL: " << ldConfigTool;
@@ -132,12 +135,8 @@ bool cmBinUtilsLinuxELFLinker::ScanDependencies(
parentRpaths.end());
}
std::vector<std::string> ldConfigPaths;
if (!this->LDConfigTool->GetLDConfigPaths(ldConfigPaths)) {
return false;
}
searchPaths.insert(searchPaths.end(), ldConfigPaths.begin(),
ldConfigPaths.end());
searchPaths.insert(searchPaths.end(), this->LDConfigPaths.begin(),
this->LDConfigPaths.end());
for (auto const& dep : needed) {
if (!this->Archive->IsPreExcluded(dep)) {