diff options
author | Brad King <brad.king@kitware.com> | 2013-01-11 16:32:13 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-01-11 16:32:13 (GMT) |
commit | c0c8ef85fc8d65a47abfd293031bcde91e7ee930 (patch) | |
tree | b6757f134e0f5ba48b6fe656d55a97eeb60535d5 /Source/cmGeneratorExpression.cxx | |
parent | ffe93315a2554c16f7bb46a35a848602cea229f9 (diff) | |
parent | 77d26467848fd689fbbffbaa302d041aa2365b15 (diff) | |
download | CMake-c0c8ef85fc8d65a47abfd293031bcde91e7ee930.zip CMake-c0c8ef85fc8d65a47abfd293031bcde91e7ee930.tar.gz CMake-c0c8ef85fc8d65a47abfd293031bcde91e7ee930.tar.bz2 |
Merge topic 'LINK_INTERFACE_LIBRARIES-genex'
77d2646 Allow generator expressions in LINK_INTERFACE_LIBRARIES.
94aeaf7 Split LINK_INTERFACE_LIBRARIES export handling into dedicated method.
a3aedb8 Split the generator expression before extracting targets.
b6036d1 Extract the AddTargetNamespace method.
cb1afbf Don't pass a position when determining if a target name is a literal.
f99196d Add cmGeneratorExpression::Split() API.
Diffstat (limited to 'Source/cmGeneratorExpression.cxx')
-rw-r--r-- | Source/cmGeneratorExpression.cxx | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 4063697..d306dee 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -251,6 +251,67 @@ static std::string stripExportInterface(const std::string &input, } //---------------------------------------------------------------------------- +void cmGeneratorExpression::Split(const std::string &input, + std::vector<std::string> &output) +{ + std::string::size_type pos = 0; + std::string::size_type lastPos = pos; + while((pos = input.find("$<", lastPos)) != input.npos) + { + std::string part = input.substr(lastPos, pos - lastPos); + std::string preGenex; + if (!part.empty()) + { + std::string::size_type startPos = input.rfind(";", pos); + if (startPos != pos - 1 && startPos >= lastPos) + { + part = input.substr(lastPos, startPos - lastPos); + preGenex = input.substr(startPos + 1, pos - startPos - 1); + } + cmSystemTools::ExpandListArgument(part.c_str(), output); + } + pos += 2; + int nestingLevel = 1; + const char *c = input.c_str() + pos; + const char * const cStart = c; + for ( ; *c; ++c) + { + if(c[0] == '$' && c[1] == '<') + { + ++nestingLevel; + ++c; + continue; + } + if(c[0] == '>') + { + --nestingLevel; + if (nestingLevel == 0) + { + break; + } + } + } + for ( ; *c; ++c) + { + // Capture the part after the genex and before the next ';' + if(c[0] == ';') + { + --c; + break; + } + } + const std::string::size_type traversed = (c - cStart) + 1; + output.push_back(preGenex + "$<" + input.substr(pos, traversed)); + pos += traversed; + lastPos = pos; + } + if (lastPos < input.size()) + { + cmSystemTools::ExpandListArgument(input.substr(lastPos), output); + } +} + +//---------------------------------------------------------------------------- std::string cmGeneratorExpression::Preprocess(const std::string &input, PreprocessContext context) { |