diff options
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluator.cxx')
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 97 |
1 files changed, 61 insertions, 36 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 97ba524..63d4126 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -453,8 +453,6 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode const char *prop = target->GetProperty(propertyName.c_str()); - std::string linkedTargetsContent; - if (dagCheckerParent) { if (dagCheckerParent->EvaluatingLinkLibraries()) @@ -468,47 +466,74 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode { assert(dagCheckerParent->EvaluatingIncludeDirectories() || dagCheckerParent->EvaluatingCompileDefinitions()); + } + } + + std::string linkedTargetsContent; + + std::string interfacePropertyName; + + if (propertyName == "INTERFACE_INCLUDE_DIRECTORIES" + || propertyName == "INCLUDE_DIRECTORIES") + { + interfacePropertyName = "INTERFACE_INCLUDE_DIRECTORIES"; + } + else if (propertyName == "INTERFACE_COMPILE_DEFINITIONS" + || propertyName == "COMPILE_DEFINITIONS" + || strncmp(propertyName.c_str(), "COMPILE_DEFINITIONS_", 20) == 0) + { + interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS"; + } + + if (interfacePropertyName == "INTERFACE_INCLUDE_DIRECTORIES" + || interfacePropertyName == "INTERFACE_COMPILE_DEFINITIONS") + { + const cmTarget::LinkInterface *iface = target->GetLinkInterface( + context->Config, + context->HeadTarget); + if(iface) + { + cmGeneratorExpression ge(context->Backtrace); - if (propertyName == "INTERFACE_INCLUDE_DIRECTORIES" - || propertyName == "INTERFACE_COMPILE_DEFINITIONS") + std::string sep; + std::string depString; + for (std::vector<std::string>::const_iterator + it = iface->Libraries.begin(); + it != iface->Libraries.end(); ++it) { - const cmTarget::LinkInterface *iface = target->GetLinkInterface( - context->Config, - context->HeadTarget); - if(iface) + if (*it == target->GetName()) + { + // Broken code can have a target in its own link interface. + // Don't follow such link interface entries so as not to create a + // self-referencing loop. + continue; + } + if (context->Makefile->FindTargetToUse(it->c_str())) { - cmGeneratorExpression ge(context->Backtrace); - - std::string sep; - std::string depString; - for (std::vector<std::string>::const_iterator - it = iface->Libraries.begin(); - it != iface->Libraries.end(); ++it) - { - if (context->Makefile->FindTargetToUse(it->c_str())) - { - depString += - sep + "$<TARGET_PROPERTY:" + *it + "," + propertyName + ">"; - sep = ";"; - } - } - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(depString); - linkedTargetsContent = cge->Evaluate(context->Makefile, - context->Config, - context->Quiet, - context->HeadTarget, - target, - &dagChecker); - if (cge->GetHadContextSensitiveCondition()) - { - context->HadContextSensitiveCondition = true; - } + depString += + sep + "$<TARGET_PROPERTY:" + *it + "," + + interfacePropertyName + ">"; + sep = ";"; } } + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = + ge.Parse(depString); + linkedTargetsContent = cge->Evaluate(context->Makefile, + context->Config, + context->Quiet, + context->HeadTarget, + target, + &dagChecker); + if (cge->GetHadContextSensitiveCondition()) + { + context->HadContextSensitiveCondition = true; + } } } + linkedTargetsContent = + cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); + if (!prop) { if (target->IsImported()) @@ -542,7 +567,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode sizeof(*targetPropertyTransitiveWhitelist)); ++i) { - if (targetPropertyTransitiveWhitelist[i] == propertyName) + if (targetPropertyTransitiveWhitelist[i] == interfacePropertyName) { cmGeneratorExpression ge(context->Backtrace); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); |