diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-12-31 14:57:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-01-07 14:38:01 (GMT) |
commit | 3917d86b261f0b88eb5cf0e8d2700c70cebdbe4b (patch) | |
tree | b870364a3fec0acba6eb8c320f665ed181281535 /Source/cmGeneratorExpressionEvaluator.cxx | |
parent | 5169130539110ff479875e76784109f174c28c69 (diff) | |
download | CMake-3917d86b261f0b88eb5cf0e8d2700c70cebdbe4b.zip CMake-3917d86b261f0b88eb5cf0e8d2700c70cebdbe4b.tar.gz CMake-3917d86b261f0b88eb5cf0e8d2700c70cebdbe4b.tar.bz2 |
Genex: Add a nullary form for CONFIG
This is consistent with other similar expressions such as PLATFORM_ID,
and makes the CONFIGURATION expression obsolete.
Fix an off-by-one error in
GeneratorExpressionContent::EvaluateParameters exposed by a unit test.
Remove the test for 'bad' nullary use of $<CONFIG>.
Add a unit test to verify that $<CONFIG> and $<CONFIGURATION> have
the same value.
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluator.cxx')
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 259ba94..5edea86 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -676,13 +676,17 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode { ConfigurationTestNode() {} - virtual int NumExpectedParameters() const { return 1; } + virtual int NumExpectedParameters() const { return OneOrZeroParameters; } std::string Evaluate(const std::vector<std::string> ¶meters, cmGeneratorExpressionContext *context, const GeneratorExpressionContent *content, cmGeneratorExpressionDAGChecker *) const { + if (parameters.empty()) + { + return configurationNode.Evaluate(parameters, context, content, 0); + } cmsys::RegularExpression configValidator; configValidator.compile("^[A-Za-z0-9_]*$"); if (!configValidator.find(parameters.begin()->c_str())) @@ -1801,7 +1805,7 @@ std::string GeneratorExpressionContent::EvaluateParameters( + "> expression requires at least one parameter."); } if (numExpected == cmGeneratorExpressionNode::OneOrZeroParameters - && parameters.size() > 2) + && parameters.size() > 1) { reportError(context, this->GetOriginalExpression(), "$<" + identifier + "> expression requires one or zero parameters."); |