summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2019-05-29 18:49:36 (GMT)
committerBrad King <brad.king@kitware.com>2019-06-03 14:20:22 (GMT)
commit2d4787fc4ddc077e1d8fcb807768d1ecc7902a73 (patch)
tree39ebe9da9d8349756c89f08d50e9f44f1ffb4107 /Source
parent5e2d22c177add56b2538ab10954dfb049c5cf945 (diff)
downloadCMake-2d4787fc4ddc077e1d8fcb807768d1ecc7902a73.zip
CMake-2d4787fc4ddc077e1d8fcb807768d1ecc7902a73.tar.gz
CMake-2d4787fc4ddc077e1d8fcb807768d1ecc7902a73.tar.bz2
Genex: Add more extensive support for an unbounded number of parameters
Previously genex support for unbounded number of parameters required at least 1 parameter. We now support zero or more parameters, and two or more parameters.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx10
-rw-r--r--Source/cmGeneratorExpressionNode.h4
2 files changed, 10 insertions, 4 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 268de6f..7442018 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -166,9 +166,13 @@ std::string GeneratorExpressionContent::EvaluateParameters(
reportError(context, this->GetOriginalExpression(),
"$<" + identifier +
"> expression requires at least one parameter.");
- }
- if (numExpected == cmGeneratorExpressionNode::OneOrZeroParameters &&
- parameters.size() > 1) {
+ } else if (numExpected == cmGeneratorExpressionNode::TwoOrMoreParameters &&
+ parameters.size() < 2) {
+ reportError(context, this->GetOriginalExpression(),
+ "$<" + identifier +
+ "> expression requires at least two parameters.");
+ } else if (numExpected == cmGeneratorExpressionNode::OneOrZeroParameters &&
+ parameters.size() > 1) {
reportError(context, this->GetOriginalExpression(),
"$<" + identifier +
"> expression requires one or zero parameters.");
diff --git a/Source/cmGeneratorExpressionNode.h b/Source/cmGeneratorExpressionNode.h
index 3dbfc6e..7a36924 100644
--- a/Source/cmGeneratorExpressionNode.h
+++ b/Source/cmGeneratorExpressionNode.h
@@ -20,7 +20,9 @@ struct cmGeneratorExpressionNode
{
DynamicParameters = 0,
OneOrMoreParameters = -1,
- OneOrZeroParameters = -2
+ TwoOrMoreParameters = -2,
+ ZeroOrMoreParameters = -3,
+ OneOrZeroParameters = -4
};
virtual ~cmGeneratorExpressionNode() = default;