Fix the cmGeneratorExpression::Split when leading chars are present.

In the case of input like

 foo$<1:bar>

the preGenex should be 'foo'. In that case, the search for a ';'
will not find one, and there is no preceding input to process as a
non-genex list.

Previously, the result of 'splitting' such a string would instead
be a vector containing the same string two times.
This commit is contained in:
Stephen Kelly 2013-02-28 17:39:27 +01:00
parent 42c56c824c
commit f93a388c9c
1 changed files with 10 additions and 2 deletions

View File

@ -302,13 +302,21 @@ void cmGeneratorExpression::Split(const std::string &input,
if (!part.empty()) if (!part.empty())
{ {
std::string::size_type startPos = input.rfind(";", pos); std::string::size_type startPos = input.rfind(";", pos);
if (startPos != pos - 1 && startPos >= lastPos) if (startPos == std::string::npos)
{
preGenex = part;
part = "";
}
else if (startPos != pos - 1 && startPos >= lastPos)
{ {
part = input.substr(lastPos, startPos - lastPos); part = input.substr(lastPos, startPos - lastPos);
preGenex = input.substr(startPos + 1, pos - startPos - 1); preGenex = input.substr(startPos + 1, pos - startPos - 1);
} }
if(!part.empty())
{
cmSystemTools::ExpandListArgument(part.c_str(), output); cmSystemTools::ExpandListArgument(part.c_str(), output);
} }
}
pos += 2; pos += 2;
int nestingLevel = 1; int nestingLevel = 1;
const char *c = input.c_str() + pos; const char *c = input.c_str() + pos;