mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-24 19:59:47 +08:00
Allow generator expressions to require literals.
This commit is contained in:
@@ -47,6 +47,8 @@ struct cmGeneratorExpressionNode
|
|||||||
|
|
||||||
virtual bool GeneratesContent() const { return true; }
|
virtual bool GeneratesContent() const { return true; }
|
||||||
|
|
||||||
|
virtual bool RequiresLiteralInput() const { return false; }
|
||||||
|
|
||||||
virtual bool AcceptsSingleArbitraryContentParameter() const
|
virtual bool AcceptsSingleArbitraryContentParameter() const
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
|
||||||
@@ -692,6 +694,15 @@ std::string GeneratorExpressionContent::Evaluate(
|
|||||||
= pit->end();
|
= pit->end();
|
||||||
for ( ; it != end; ++it)
|
for ( ; it != end; ++it)
|
||||||
{
|
{
|
||||||
|
if (node->RequiresLiteralInput())
|
||||||
|
{
|
||||||
|
if ((*it)->GetType() != cmGeneratorExpressionEvaluator::Text)
|
||||||
|
{
|
||||||
|
reportError(context, this->GetOriginalExpression(),
|
||||||
|
"$<" + identifier + "> expression requires literal input.");
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
}
|
||||||
result += (*it)->Evaluate(context, dagChecker);
|
result += (*it)->Evaluate(context, dagChecker);
|
||||||
if (context->HadError)
|
if (context->HadError)
|
||||||
{
|
{
|
||||||
@@ -699,6 +710,12 @@ std::string GeneratorExpressionContent::Evaluate(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (node->RequiresLiteralInput())
|
||||||
|
{
|
||||||
|
std::vector<std::string> parameters;
|
||||||
|
parameters.push_back(result);
|
||||||
|
return node->Evaluate(parameters, context, this, dagChecker);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user