Commit b279f2b4 authored by Stephen Kelly's avatar Stephen Kelly Committed by Brad King

Strip consecutive semicolons when preprocessing genex strings.

parent 3367d0cc
...@@ -147,6 +147,38 @@ cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression() ...@@ -147,6 +147,38 @@ cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression()
} }
} }
//----------------------------------------------------------------------------
static std::string stripEmptyListElements(const std::string &input)
{
std::string result;
const char *c = input.c_str();
bool skipSemiColons = true;
for ( ; *c; ++c)
{
if(c[0] == ';')
{
if(skipSemiColons)
{
continue;
}
skipSemiColons = true;
}
else
{
skipSemiColons = false;
}
result += *c;
}
if (!result.empty() && *(result.end() - 1) == ';')
{
result.resize(result.size() - 1);
}
return result;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static std::string stripAllGeneratorExpressions(const std::string &input) static std::string stripAllGeneratorExpressions(const std::string &input)
{ {
...@@ -186,7 +218,7 @@ static std::string stripAllGeneratorExpressions(const std::string &input) ...@@ -186,7 +218,7 @@ static std::string stripAllGeneratorExpressions(const std::string &input)
lastPos = pos; lastPos = pos;
} }
result += input.substr(lastPos); result += input.substr(lastPos);
return result; return stripEmptyListElements(result);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -247,7 +279,7 @@ static std::string stripExportInterface(const std::string &input, ...@@ -247,7 +279,7 @@ static std::string stripExportInterface(const std::string &input,
} }
result += input.substr(lastPos); result += input.substr(lastPos);
return result; return stripEmptyListElements(result);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment