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.
This commit is contained in:
Stephen Kelly 2013-05-02 16:52:48 +02:00 committed by Brad King
parent 26dba6a162
commit dea1df4e5e
1 changed files with 18 additions and 4 deletions

View File

@ -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;
@ -164,6 +164,19 @@ void deleteAndClear(
entries.clear();
}
//----------------------------------------------------------------------------
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()
{
@ -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,