diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-05-02 14:52:48 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-05-06 13:59:28 (GMT) |
commit | dea1df4e5e05b8ba3de5099741a50cdea384f88e (patch) | |
tree | 9ca7ec9da55399769aa66282f23a94fa44fd016b | |
parent | 26dba6a1622422d3742254aa2ecab97f9a58cb2b (diff) | |
download | CMake-dea1df4e5e05b8ba3de5099741a50cdea384f88e.zip CMake-dea1df4e5e05b8ba3de5099741a50cdea384f88e.tar.gz CMake-dea1df4e5e05b8ba3de5099741a50cdea384f88e.tar.bz2 |
Memoize usage requirement include directories in a config-specific map
Commit 42ebb188 (Memoize includes and defines from interface libraries.,
2013-02-22) introduced caching of the includes. Fix the memoization to
be configuration-specific so that we do not accumulate entries across
multiple evaluations in a multi-config generator.
-rw-r--r-- | Source/cmTarget.cxx | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1ccfa47..d14bfca 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -142,7 +142,7 @@ public: std::vector<IncludeDirectoriesEntry*> IncludeDirectoriesEntries; std::vector<cmValueWithOrigin> LinkInterfaceIncludeDirectoriesEntries; - std::vector<IncludeDirectoriesEntry*> + std::map<std::string, std::vector<IncludeDirectoriesEntry*> > CachedLinkInterfaceIncludeDirectoriesEntries; std::map<std::string, std::string> CachedLinkInterfaceCompileDefinitions; @@ -165,6 +165,19 @@ void deleteAndClear( } //---------------------------------------------------------------------------- +void deleteAndClear( + std::map<std::string, + std::vector<cmTargetInternals::IncludeDirectoriesEntry*> > &entries) +{ + for (std::map<std::string, + std::vector<cmTargetInternals::IncludeDirectoriesEntry*> >::iterator + it = entries.begin(), end = entries.end(); it != end; ++it) + { + deleteAndClear(it->second); + } +} + +//---------------------------------------------------------------------------- cmTargetInternals::~cmTargetInternals() { deleteAndClear(CachedLinkInterfaceIncludeDirectoriesEntries); @@ -2976,14 +2989,15 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config) cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse( includeGenex); - this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries.push_back( + this->Internal + ->CachedLinkInterfaceIncludeDirectoriesEntries[configString].push_back( new cmTargetInternals::IncludeDirectoriesEntry(cge, it->Value)); } } processIncludeDirectories(this, - this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries, + this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[configString], includes, uniqueIncludes, &dagChecker, @@ -2993,7 +3007,7 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config) if (!this->Makefile->IsGeneratingBuildSystem()) { deleteAndClear( - this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries); + this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries); } else { |