mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 16:32:14 -06:00
macOS: Speed up rpath install name dir lookup with a cache
Fixes: #20602
This commit is contained in:
@@ -2169,6 +2169,21 @@ bool cmGeneratorTarget::IsImportedSharedLibWithoutSOName(
|
||||
|
||||
bool cmGeneratorTarget::HasMacOSXRpathInstallNameDir(
|
||||
const std::string& config) const
|
||||
{
|
||||
TargetPtrToBoolMap& cache = this->MacOSXRpathInstallNameDirCache[config];
|
||||
const auto lookup = cache.find(this->Target);
|
||||
|
||||
if (lookup != cache.cend()) {
|
||||
return lookup->second;
|
||||
}
|
||||
|
||||
const bool result = this->DetermineHasMacOSXRpathInstallNameDir(config);
|
||||
cache[this->Target] = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool cmGeneratorTarget::DetermineHasMacOSXRpathInstallNameDir(
|
||||
const std::string& config) const
|
||||
{
|
||||
bool install_name_is_rpath = false;
|
||||
bool macosx_rpath = false;
|
||||
|
||||
@@ -866,6 +866,11 @@ private:
|
||||
mutable std::map<cmSourceFile const*, std::string> Objects;
|
||||
std::set<cmSourceFile const*> ExplicitObjectName;
|
||||
|
||||
using TargetPtrToBoolMap = std::unordered_map<cmTarget*, bool>;
|
||||
mutable std::unordered_map<std::string, TargetPtrToBoolMap>
|
||||
MacOSXRpathInstallNameDirCache;
|
||||
bool DetermineHasMacOSXRpathInstallNameDir(const std::string& config) const;
|
||||
|
||||
// "config/language" is the key
|
||||
mutable std::map<std::string, std::vector<std::string>> SystemIncludesCache;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user