cmTarget: Simplify INTERFACE_COMPILE_DEFINITIONS usage requirement lookup

Use the AddInterfaceEntries helper to avoid duplication.
This commit is contained in:
Brad King 2014-06-19 13:38:51 -04:00
parent d9586f83f1
commit 61ef8daad5
1 changed files with 3 additions and 39 deletions

View File

@ -2504,45 +2504,9 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config]) if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config])
{ {
for (std::vector<cmValueWithOrigin>::const_iterator this->Internal->AddInterfaceEntries(
it = this->Internal->LinkImplementationPropertyEntries.begin(), this, config, "INTERFACE_COMPILE_DEFINITIONS",
end = this->Internal->LinkImplementationPropertyEntries.end(); this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[config]);
it != end; ++it)
{
if (!cmGeneratorExpression::IsValidTargetName(it->Value)
&& cmGeneratorExpression::Find(it->Value) == std::string::npos)
{
continue;
}
{
cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(it->Value);
std::string targetResult = cge->Evaluate(this->Makefile, config,
false, this, 0, 0);
if (!this->Makefile->FindTargetToUse(targetResult))
{
continue;
}
}
std::string defsGenex = "$<TARGET_PROPERTY:" +
it->Value + ",INTERFACE_COMPILE_DEFINITIONS>";
if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
{
// Because it->Value is a generator expression, ensure that it
// evaluates to the non-empty string before being used in the
// TARGET_PROPERTY expression.
defsGenex = "$<$<BOOL:" + it->Value + ">:" + defsGenex + ">";
}
cmGeneratorExpression ge(&it->Backtrace);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
defsGenex);
this->Internal
->CachedLinkInterfaceCompileDefinitionsEntries[config].push_back(
new cmTargetInternals::TargetPropertyEntry(cge,
it->Value));
}
if (!config.empty()) if (!config.empty())
{ {
std::string configPropName = "COMPILE_DEFINITIONS_" std::string configPropName = "COMPILE_DEFINITIONS_"