Merge topic 'fix-transitive-OBJECT_SOURCES-context'

672f1001 Genex: Fix evaluation context propagation for TARGET_OBJECTS.
This commit is contained in:
Brad King 2014-12-01 08:57:28 -05:00 committed by CMake Topic Stage
commit 22b72b1894
2 changed files with 44 additions and 35 deletions

View File

@ -69,8 +69,41 @@ struct cmGeneratorExpressionNode
const GeneratorExpressionContent *content, const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *dagChecker cmGeneratorExpressionDAGChecker *dagChecker
) const = 0; ) 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 static const struct ZeroNode : public cmGeneratorExpressionNode
{ {
@ -825,22 +858,10 @@ getLinkedTargetsContent(
} }
if(!depString.empty()) if(!depString.empty())
{ {
cmGeneratorExpression ge(&context->Backtrace); linkedTargetsContent =
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(depString); cmGeneratorExpressionNode::EvaluateDependentExpression(depString,
linkedTargetsContent = cge->Evaluate(target->GetMakefile(), target->GetMakefile(), context,
context->Config, headTarget, target, dagChecker);
context->Quiet,
headTarget,
target,
dagChecker);
if (cge->GetHadContextSensitiveCondition())
{
context->HadContextSensitiveCondition = true;
}
if (cge->GetHadHeadSensitiveCondition())
{
context->HadHeadSensitiveCondition = true;
}
} }
linkedTargetsContent = linkedTargetsContent =
cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent);
@ -1185,24 +1206,9 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
} }
if(!interfacePropertyName.empty()) if(!interfacePropertyName.empty())
{ {
cmGeneratorExpression ge(&context->Backtrace); std::string result = this->EvaluateDependentExpression(prop,
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); context->Makefile, context,
cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); headTarget, target, &dagChecker);
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;
}
if (!linkedTargetsContent.empty()) if (!linkedTargetsContent.empty())
{ {
result += (result.empty() ? "" : ";") + linkedTargetsContent; result += (result.empty() ? "" : ";") + linkedTargetsContent;

View File

@ -22,8 +22,11 @@ add_library(objlib OBJECT obj.cpp)
add_library(iface_objlib INTERFACE) add_library(iface_objlib INTERFACE)
target_sources(iface_objlib INTERFACE $<TARGET_OBJECTS:objlib>) target_sources(iface_objlib INTERFACE $<TARGET_OBJECTS:objlib>)
add_library(intermediate INTERFACE)
target_link_libraries(intermediate INTERFACE iface_objlib)
add_executable(InterfaceLibrary definetestexe.cpp) 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) add_subdirectory(libsdir)