Genex: Don't segfault on $<FOO,>

Treat the comma as part of the identifier here. It will later not
resolve to a generator expression and the user gets a proper error
message.
This commit is contained in:
Stephen Kelly 2012-11-26 22:44:13 +01:00 committed by Brad King
parent 07749e3705
commit b581be0767
3 changed files with 19 additions and 1 deletions

View File

@ -88,7 +88,15 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
while(this->it->TokenType != cmGeneratorExpressionToken::EndExpression
&& this->it->TokenType != cmGeneratorExpressionToken::ColonSeparator)
{
if (this->it->TokenType == cmGeneratorExpressionToken::CommaSeparator)
{
extendText(identifier, this->it);
++this->it;
}
else
{
this->ParseContent(identifier);
}
if (this->it == this->Tokens.end())
{
break;

View File

@ -6,3 +6,12 @@ CMake Error at BadZero.cmake:2 \(add_custom_target\):
\$<0> expression requires a parameter.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
CMake Error at BadZero.cmake:2 \(add_custom_target\):
Error evaluating generator expression:
\$<0,>
Expression did not evaluate to a known generator expression
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -1,4 +1,5 @@
add_custom_target(check ALL COMMAND check
$<0>
$<0,>
VERBATIM)