|
|
@@ -157,17 +157,24 @@ cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression()
|
|
|
std::string cmGeneratorExpression::StripEmptyListElements(
|
|
|
const std::string &input)
|
|
|
{
|
|
|
+ if (input.find(';') == input.npos)
|
|
|
+ {
|
|
|
+ return input;
|
|
|
+ }
|
|
|
std::string result;
|
|
|
+ result.reserve(input.size());
|
|
|
|
|
|
const char *c = input.c_str();
|
|
|
+ const char *last = c;
|
|
|
bool skipSemiColons = true;
|
|
|
for ( ; *c; ++c)
|
|
|
{
|
|
|
- if(c[0] == ';')
|
|
|
+ if(*c == ';')
|
|
|
{
|
|
|
if(skipSemiColons)
|
|
|
{
|
|
|
- continue;
|
|
|
+ result.append(last, c - last);
|
|
|
+ last = c + 1;
|
|
|
}
|
|
|
skipSemiColons = true;
|
|
|
}
|
|
|
@@ -175,8 +182,8 @@ std::string cmGeneratorExpression::StripEmptyListElements(
|
|
|
{
|
|
|
skipSemiColons = false;
|
|
|
}
|
|
|
- result += *c;
|
|
|
}
|
|
|
+ result.append(last);
|
|
|
|
|
|
if (!result.empty() && *(result.end() - 1) == ';')
|
|
|
{
|