Pārlūkot izejas kodu

cmBinUtilsLinuxELFLinker: Cache ldconfig results

Running GetLDConfigPaths in every ScanDependencies is expensive.
Atılhan Emre Dursunoğlu 2 gadi atpakaļ
vecāks
revīzija
f173ca21ca
1 mainītis faili ar 5 papildinājumiem un 6 dzēšanām
  1. 5 6
      Source/cmBinUtilsLinuxELFLinker.cxx

+ 5 - 6
Source/cmBinUtilsLinuxELFLinker.cxx

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