summaryrefslogtreecommitdiff
path: root/Source/cmGeneratorExpression.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-09-16 08:55:21 -0400
committerCMake Topic Stage <kwrobot@kitware.com>2013-09-16 08:55:21 -0400
commit237aaafe8015b3cfc8e9124754c0036de595e12c (patch)
tree7b2c85a3f9e334bdd3b704864235f4a24988f4fc /Source/cmGeneratorExpression.cxx
parentc1122e1ecb0e22e61aabf87174845c475a3699e1 (diff)
parent70089d0769902c58da925eb571ad430bec40e9da (diff)
downloadcmake-237aaafe8015b3cfc8e9124754c0036de595e12c.tar.gz
Merge topic 'fix-genex-preprocessing-incomplete'
70089d0 genex: Fix preprocessing with incomplete content (#14410).
Diffstat (limited to 'Source/cmGeneratorExpression.cxx')
-rw-r--r--Source/cmGeneratorExpression.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index e962313048..127cf6b326 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -192,11 +192,12 @@ static std::string stripAllGeneratorExpressions(const std::string &input)
std::string result;
std::string::size_type pos = 0;
std::string::size_type lastPos = pos;
+ int nestingLevel = 0;
while((pos = input.find("$<", lastPos)) != input.npos)
{
result += input.substr(lastPos, pos - lastPos);
pos += 2;
- int nestingLevel = 1;
+ nestingLevel = 1;
const char *c = input.c_str() + pos;
const char * const cStart = c;
for ( ; *c; ++c)
@@ -224,7 +225,10 @@ static std::string stripAllGeneratorExpressions(const std::string &input)
pos += traversed;
lastPos = pos;
}
- result += input.substr(lastPos);
+ if (nestingLevel == 0)
+ {
+ result += input.substr(lastPos);
+ }
return cmGeneratorExpression::StripEmptyListElements(result);
}
@@ -253,6 +257,7 @@ static std::string stripExportInterface(const std::string &input,
{
std::string result;
+ int nestingLevel = 0;
std::string::size_type pos = 0;
std::string::size_type lastPos = pos;
while (true)
@@ -282,7 +287,7 @@ static std::string stripExportInterface(const std::string &input,
const bool gotInstallInterface = input[pos + 2] == 'I';
pos += gotInstallInterface ? sizeof("$<INSTALL_INTERFACE:") - 1
: sizeof("$<BUILD_INTERFACE:") - 1;
- int nestingLevel = 1;
+ nestingLevel = 1;
const char *c = input.c_str() + pos;
const char * const cStart = c;
for ( ; *c; ++c)
@@ -331,7 +336,10 @@ static std::string stripExportInterface(const std::string &input,
pos += traversed;
lastPos = pos;
}
- result += input.substr(lastPos);
+ if (nestingLevel == 0)
+ {
+ result += input.substr(lastPos);
+ }
return cmGeneratorExpression::StripEmptyListElements(result);
}