cmGeneratorExpressionParser: Remove dead "if empty" check

Add a test case to verify preservation of the existing behavior, which
is an evaluation error.
This commit is contained in:
Tyler Yankee committed 2026-10-26 15:48:49 -04:00
1 parent edb5bbbe0a
commit b7f4d4b5dd
5 files changed
+23 -3

No files matched your search

-3
View File
@@ -82,9 +82,6 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
break;
}
}
if (identifier.empty()) {
// ERROR
}
if (this->it != this->Tokens.end() &&
this->it->TokenType == cmGeneratorExpressionToken::EndExpression) {
@@ -0,0 +1 @@
1
@@ -0,0 +1,17 @@
CMake Error at BadEmpty\.cmake:1 \(add_custom_target\):
Error evaluating generator expression:
\$<>
Expression did not evaluate to a known generator expression
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)
+
CMake Error at BadEmpty\.cmake:1 \(add_custom_target\):
Error evaluating generator expression:
\$<:foo>
Expression did not evaluate to a known generator expression
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)
@@ -0,0 +1,4 @@
add_custom_target(check ALL COMMAND check
$<>
$<:foo>
VERBATIM)
@@ -20,6 +20,7 @@ run_cmake(STRLESS_EQUAL)
run_cmake(STRGREATER)
run_cmake(STRGREATER_EQUAL)
run_cmake(BadZero)
run_cmake(BadEmpty)
run_cmake(BadTargetName)
run_cmake(BadTargetTypeInterface)
run_cmake(BadTargetTypeObject)