summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-09-21 15:06:04 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-09-21 15:06:25 (GMT)
commit62834c07603e82aafabc082bbbcf74179a4cda27 (patch)
tree01d7c3f0608bb8a8fe9c53b0a23a9dcbd5b33ab4
parentb0b689d5660f8f6d2a05bf070b2c72ddf3091b75 (diff)
parent2266e223c56be365cadfdf9f394009c095a37c8b (diff)
downloadCMake-62834c07603e82aafabc082bbbcf74179a4cda27.zip
CMake-62834c07603e82aafabc082bbbcf74179a4cda27.tar.gz
CMake-62834c07603e82aafabc082bbbcf74179a4cda27.tar.bz2
Merge topic 'macos-cache-rpath-install-namedir'
2266e223c5 macOS: Speed up rpath install name dir lookup with a cache Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6543
-rw-r--r--Source/cmGeneratorTarget.cxx15
-rw-r--r--Source/cmGeneratorTarget.h5
2 files changed, 20 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index d52dfaf..f80b4d9 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -2170,6 +2170,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;
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 0076085..85b4ea0 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -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;