summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-01-23 15:40:43 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-01-23 15:40:53 (GMT)
commit709bc0368f9a34577309698c3c7b246c56b75c17 (patch)
treead3665ac1369a4ddcaf4c766fa745a7c3050d08e /Source
parentc9fc146a93b202c6aaba813d16e66cc6f3f6e2ac (diff)
parent910ada1a88f4196cd441d6c6cde9c30629785d6e (diff)
downloadCMake-709bc0368f9a34577309698c3c7b246c56b75c17.zip
CMake-709bc0368f9a34577309698c3c7b246c56b75c17.tar.gz
CMake-709bc0368f9a34577309698c3c7b246c56b75c17.tar.bz2
Merge topic 'genex-CONFIG-validate-all'
910ada1a88 Genex: $<CONFIG:> syntax of all entries checked 42e417ad12 GeneratorExpression Tests: Remove duplicate test entry Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8082
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorExpressionNode.cxx24
1 files changed, 21 insertions, 3 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index e33ebd7..6595323 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -1352,12 +1352,30 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
}
static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$");
if (!configValidator.find(parameters.front())) {
- reportError(context, content->GetOriginalExpression(),
- "Expression syntax not recognized.");
- return std::string();
}
+
context->HadContextSensitiveCondition = true;
+ bool firstParam = true;
for (auto const& param : parameters) {
+ if (!configValidator.find(param)) {
+ if (firstParam) {
+ reportError(context, content->GetOriginalExpression(),
+ "Expression syntax not recognized.");
+ return std::string();
+ }
+ // for backwards compat invalid config names are only errors as
+ // the first parameter
+ std::ostringstream e;
+ /* clang-format off */
+ e << "Warning evaluating generator expression:\n"
+ << " " << content->GetOriginalExpression() << "\n"
+ << "The config name of \"" << param << "\" is invalid";
+ /* clang-format on */
+ context->LG->GetCMakeInstance()->IssueMessage(
+ MessageType::WARNING, e.str(), context->Backtrace);
+ }
+
+ firstParam = false;
if (context->Config.empty()) {
if (param.empty()) {
return "1";