Genex: Ensure that $<0:...> has a parameter.
This commit is contained in:
parent
ee96dc7686
commit
07749e3705
|
@ -66,6 +66,8 @@ static const struct ZeroNode : public cmGeneratorExpressionNode
|
|||
|
||||
virtual bool GeneratesContent() const { return false; }
|
||||
|
||||
virtual bool AcceptsSingleArbitraryContentParameter() const { return true; }
|
||||
|
||||
std::string Evaluate(const std::vector<std::string> &,
|
||||
cmGeneratorExpressionContext *,
|
||||
const GeneratorExpressionContent *,
|
||||
|
@ -642,6 +644,20 @@ std::string GeneratorExpressionContent::Evaluate(
|
|||
|
||||
if (!node->GeneratesContent())
|
||||
{
|
||||
if (node->AcceptsSingleArbitraryContentParameter())
|
||||
{
|
||||
if (this->ParamChildren.empty())
|
||||
{
|
||||
reportError(context, this->GetOriginalExpression(),
|
||||
"$<" + identifier + "> expression requires a parameter.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<std::string> parameters;
|
||||
this->EvaluateParameters(node, identifier, context, dagChecker,
|
||||
parameters);
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -0,0 +1,8 @@
|
|||
CMake Error at BadZero.cmake:2 \(add_custom_target\):
|
||||
Error evaluating generator expression:
|
||||
|
||||
\$<0>
|
||||
|
||||
\$<0> expression requires a parameter.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
add_custom_target(check ALL COMMAND check
|
||||
$<0>
|
||||
VERBATIM)
|
|
@ -5,3 +5,4 @@ run_cmake(BadOR)
|
|||
run_cmake(BadAND)
|
||||
run_cmake(BadNOT)
|
||||
run_cmake(BadStrEqual)
|
||||
run_cmake(BadZero)
|
||||
|
|
Loading…
Reference in New Issue