mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 22:37:30 +08:00
@@ -1352,12 +1352,30 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
|
|||||||
}
|
}
|
||||||
static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$");
|
static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$");
|
||||||
if (!configValidator.find(parameters.front())) {
|
if (!configValidator.find(parameters.front())) {
|
||||||
reportError(context, content->GetOriginalExpression(),
|
|
||||||
"Expression syntax not recognized.");
|
|
||||||
return std::string();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
context->HadContextSensitiveCondition = true;
|
context->HadContextSensitiveCondition = true;
|
||||||
|
bool firstParam = true;
|
||||||
for (auto const& param : parameters) {
|
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 (context->Config.empty()) {
|
||||||
if (param.empty()) {
|
if (param.empty()) {
|
||||||
return "1";
|
return "1";
|
||||||
|
@@ -25,4 +25,13 @@ CMake Error at BadCONFIG.cmake:1 \(add_custom_target\):
|
|||||||
Call Stack \(most recent call first\):
|
Call Stack \(most recent call first\):
|
||||||
CMakeLists.txt:3 \(include\)
|
CMakeLists.txt:3 \(include\)
|
||||||
+
|
+
|
||||||
|
CMake Warning at BadCONFIG.cmake:1 \(add_custom_target\):
|
||||||
|
Warning evaluating generator expression:
|
||||||
|
|
||||||
|
\$<CONFIG:Release,Foo-Second>
|
||||||
|
|
||||||
|
The config name of "Foo-Second" is invalid
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
+
|
||||||
CMake Generate step failed\. Build files cannot be regenerated correctly\.$
|
CMake Generate step failed\. Build files cannot be regenerated correctly\.$
|
||||||
|
@@ -2,4 +2,5 @@ add_custom_target(check ALL COMMAND check
|
|||||||
$<CONFIG:.>
|
$<CONFIG:.>
|
||||||
$<CONFIG:Foo-Bar>
|
$<CONFIG:Foo-Bar>
|
||||||
$<$<CONFIG:Foo-Nested>:foo>
|
$<$<CONFIG:Foo-Nested>:foo>
|
||||||
|
$<$<CONFIG:Release,Foo-Second>:foo>
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
|
Reference in New Issue
Block a user