cmTarget: Only copy GenEx expansions when necessary

This commit is contained in:
Ben Boeckel 2014-02-10 01:24:42 -05:00
parent b75fc0e1ad
commit cd54f1dbeb
1 changed files with 13 additions and 10 deletions

View File

@ -2266,25 +2266,32 @@ static void processCompileOptionsInternal(cmTarget const* tgt,
for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator
it = entries.begin(), end = entries.end(); it != end; ++it) it = entries.begin(), end = entries.end(); it != end; ++it)
{ {
bool cacheOptions = false; std::vector<std::string>& entriesRef = (*it)->CachedEntries;
std::vector<std::string> entryOptions = (*it)->CachedEntries; std::vector<std::string> localEntries;
if(entryOptions.empty()) std::vector<std::string>* entryOptions = &entriesRef;
if(entryOptions->empty())
{ {
cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf,
config, config,
false, false,
tgt, tgt,
dagChecker), dagChecker),
entryOptions); localEntries);
if (mf->IsGeneratingBuildSystem() if (mf->IsGeneratingBuildSystem()
&& !(*it)->ge->GetHadContextSensitiveCondition()) && !(*it)->ge->GetHadContextSensitiveCondition())
{ {
cacheOptions = true; // Cache the result.
*entryOptions = localEntries;
}
else
{
// Use the context-sensitive results here.
entryOptions = &localEntries;
} }
} }
std::string usedOptions; std::string usedOptions;
for(std::vector<std::string>::iterator for(std::vector<std::string>::iterator
li = entryOptions.begin(); li != entryOptions.end(); ++li) li = entryOptions->begin(); li != entryOptions->end(); ++li)
{ {
std::string opt = *li; std::string opt = *li;
@ -2297,10 +2304,6 @@ static void processCompileOptionsInternal(cmTarget const* tgt,
} }
} }
} }
if (cacheOptions)
{
(*it)->CachedEntries = entryOptions;
}
if (!usedOptions.empty()) if (!usedOptions.empty())
{ {
mf->GetCMakeInstance()->IssueMessage(cmake::LOG, mf->GetCMakeInstance()->IssueMessage(cmake::LOG,