diff --git a/Source/cmBinUtilsLinuxELFLinker.cxx b/Source/cmBinUtilsLinuxELFLinker.cxx index 597220268f..e2a8f92103 100644 --- a/Source/cmBinUtilsLinuxELFLinker.cxx +++ b/Source/cmBinUtilsLinuxELFLinker.cxx @@ -73,6 +73,9 @@ bool cmBinUtilsLinuxELFLinker::Prepare() if (ldConfigTool == "ldconfig") { this->LDConfigTool = cm::make_unique(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 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)) {