diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-05-28 22:34:30 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-05-30 13:43:42 (GMT) |
commit | 0b39fefeac550c8277ebde308fcb9198e43e46a7 (patch) | |
tree | 20642ae8a3bcd34650cbefcd1c129f60d50175ec | |
parent | 53164ac997f6ce2a4fd1245956a815bfdb893c27 (diff) | |
download | CMake-0b39fefeac550c8277ebde308fcb9198e43e46a7.zip CMake-0b39fefeac550c8277ebde308fcb9198e43e46a7.tar.gz CMake-0b39fefeac550c8277ebde308fcb9198e43e46a7.tar.bz2 |
GenexEval: Extract a getLinkedTargetsContent from TargetPropertyNode.
This will be used to process transitive components of properties
which depend on linked targets. Currently only the link interface
of the target can be used as the source of the linked targets, but
in the next commit it will be possible to use the link implementation
as the source of link targets.
This commit does not change the semantics of the code.
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 81 |
1 files changed, 46 insertions, 35 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 60c969e..ba74e60 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -313,6 +313,48 @@ static const char* targetPropertyTransitiveWhitelist[] = { , "INTERFACE_COMPILE_DEFINITIONS" }; +std::string getLinkedTargetsContent(const std::vector<std::string> &libraries, + cmTarget *target, + cmGeneratorExpressionContext *context, + cmGeneratorExpressionDAGChecker *dagChecker, + const std::string &interfacePropertyName) +{ + cmGeneratorExpression ge(context->Backtrace); + + std::string sep; + std::string depString; + for (std::vector<std::string>::const_iterator + it = libraries.begin(); + it != libraries.end(); ++it) + { + 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())) + { + depString += + sep + "$<TARGET_PROPERTY:" + *it + "," + interfacePropertyName + ">"; + sep = ";"; + } + } + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(depString); + std::string linkedTargetsContent = cge->Evaluate(context->Makefile, + context->Config, + context->Quiet, + context->HeadTarget, + target, + dagChecker); + if (cge->GetHadContextSensitiveCondition()) + { + context->HadContextSensitiveCondition = true; + } + return linkedTargetsContent; +} + //---------------------------------------------------------------------------- struct TransitiveWhitelistCompare { @@ -508,41 +550,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode context->HeadTarget); if(iface) { - 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 (*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())) - { - 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 = + getLinkedTargetsContent(iface->Libraries, target, + context, &dagChecker, + interfacePropertyName); } } |