summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpression.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-01-13 08:39:29 (GMT)
committerBrad King <brad.king@kitware.com>2013-01-15 19:36:21 (GMT)
commitb279f2b43180b6c55dd3361c2380f7ed3c998109 (patch)
treee05ea795646ca41512a4c3ce7b133ad5a43f68f9 /Source/cmGeneratorExpression.cxx
parent3367d0cc7fe50e6b6fc06c85c8c38c683c1d3805 (diff)
downloadCMake-b279f2b43180b6c55dd3361c2380f7ed3c998109.zip
CMake-b279f2b43180b6c55dd3361c2380f7ed3c998109.tar.gz
CMake-b279f2b43180b6c55dd3361c2380f7ed3c998109.tar.bz2
Strip consecutive semicolons when preprocessing genex strings.
Diffstat (limited to 'Source/cmGeneratorExpression.cxx')
-rw-r--r--Source/cmGeneratorExpression.cxx36
1 files changed, 34 insertions, 2 deletions
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index d306dee..78ae8f2 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -148,6 +148,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)
{
std::string result;
@@ -186,7 +218,7 @@ static std::string stripAllGeneratorExpressions(const std::string &input)
lastPos = pos;
}
result += input.substr(lastPos);
- return result;
+ return stripEmptyListElements(result);
}
//----------------------------------------------------------------------------
@@ -247,7 +279,7 @@ static std::string stripExportInterface(const std::string &input,
}
result += input.substr(lastPos);
- return result;
+ return stripEmptyListElements(result);
}
//----------------------------------------------------------------------------