summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx74
-rw-r--r--Tests/InterfaceLibrary/CMakeLists.txt5
2 files changed, 44 insertions, 35 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 67a1a6d438..84a4daa599 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -69,9 +69,42 @@ struct cmGeneratorExpressionNode
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *dagChecker
) const = 0;
+
+ static std::string EvaluateDependentExpression(
+ std::string const& prop, cmMakefile *makefile,
+ cmGeneratorExpressionContext *context,
+ cmTarget const* headTarget, cmTarget const* currentTarget,
+ cmGeneratorExpressionDAGChecker *dagChecker);
};
//----------------------------------------------------------------------------
+std::string cmGeneratorExpressionNode::EvaluateDependentExpression(
+ std::string const& prop, cmMakefile *makefile,
+ cmGeneratorExpressionContext *context,
+ cmTarget const* headTarget, cmTarget const* currentTarget,
+ cmGeneratorExpressionDAGChecker *dagChecker)
+{
+ cmGeneratorExpression ge(&context->Backtrace);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
+ cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem);
+ std::string result = cge->Evaluate(makefile,
+ context->Config,
+ context->Quiet,
+ headTarget,
+ currentTarget,
+ dagChecker);
+ if (cge->GetHadContextSensitiveCondition())
+ {
+ context->HadContextSensitiveCondition = true;
+ }
+ if (cge->GetHadHeadSensitiveCondition())
+ {
+ context->HadHeadSensitiveCondition = true;
+ }
+ return result;
+}
+
+//----------------------------------------------------------------------------
static const struct ZeroNode : public cmGeneratorExpressionNode
{
ZeroNode() {}
@@ -825,22 +858,10 @@ getLinkedTargetsContent(
}
if(!depString.empty())
{
- cmGeneratorExpression ge(&context->Backtrace);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(depString);
- linkedTargetsContent = cge->Evaluate(target->GetMakefile(),
- context->Config,
- context->Quiet,
- headTarget,
- target,
- dagChecker);
- if (cge->GetHadContextSensitiveCondition())
- {
- context->HadContextSensitiveCondition = true;
- }
- if (cge->GetHadHeadSensitiveCondition())
- {
- context->HadHeadSensitiveCondition = true;
- }
+ linkedTargetsContent =
+ cmGeneratorExpressionNode::EvaluateDependentExpression(depString,
+ target->GetMakefile(), context,
+ headTarget, target, dagChecker);
}
linkedTargetsContent =
cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent);
@@ -1181,24 +1202,9 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
}
if(!interfacePropertyName.empty())
{
- cmGeneratorExpression ge(&context->Backtrace);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
- cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem);
- std::string result = cge->Evaluate(context->Makefile,
- context->Config,
- context->Quiet,
- headTarget,
- target,
- &dagChecker);
-
- if (cge->GetHadContextSensitiveCondition())
- {
- context->HadContextSensitiveCondition = true;
- }
- if (cge->GetHadHeadSensitiveCondition())
- {
- context->HadHeadSensitiveCondition = true;
- }
+ std::string result = this->EvaluateDependentExpression(prop,
+ context->Makefile, context,
+ headTarget, target, &dagChecker);
if (!linkedTargetsContent.empty())
{
result += (result.empty() ? "" : ";") + linkedTargetsContent;
diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt
index fe202dd26a..ee81419fdc 100644
--- a/Tests/InterfaceLibrary/CMakeLists.txt
+++ b/Tests/InterfaceLibrary/CMakeLists.txt
@@ -22,8 +22,11 @@ add_library(objlib OBJECT obj.cpp)
add_library(iface_objlib INTERFACE)
target_sources(iface_objlib INTERFACE $<TARGET_OBJECTS:objlib>)
+add_library(intermediate INTERFACE)
+target_link_libraries(intermediate INTERFACE iface_objlib)
+
add_executable(InterfaceLibrary definetestexe.cpp)
-target_link_libraries(InterfaceLibrary iface_nodepends headeriface subiface iface_objlib)
+target_link_libraries(InterfaceLibrary iface_nodepends headeriface subiface intermediate)
add_subdirectory(libsdir)