diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-03-14 20:40:21 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-03-18 14:09:47 (GMT) |
commit | 7a619fa6fbebdd907815be2d0edaef0184a3ad95 (patch) | |
tree | d23365fec465c80a624c69baa3370b794d223010 /Source/cmGeneratorExpression.cxx | |
parent | 55812ab0bcf8655473535c05865a63772fbf6dac (diff) | |
download | CMake-7a619fa6fbebdd907815be2d0edaef0184a3ad95.zip CMake-7a619fa6fbebdd907815be2d0edaef0184a3ad95.tar.gz CMake-7a619fa6fbebdd907815be2d0edaef0184a3ad95.tar.bz2 |
Fix cmGeneratorExpression::Preprocess for interleaved inputs.
We can't find both preprocessing expressions at once, because then
the BUILD_INTERFACE will always be favored if both are present, even
if INSTALL_INTERFACE appears first.
This was affecting the behavior of install(EXPORT) because the
INTERFACE_INCLUDE_DIRECTORIES contained entries like
/foo/include;$<INSTALL_INTERFACE:/bar/include>
As the INSTALL_INTERFACE always evaluates to '0', it always needs
to be preprocessed properly.
Diffstat (limited to 'Source/cmGeneratorExpression.cxx')
-rw-r--r-- | Source/cmGeneratorExpression.cxx | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 3f59129..ab8bd13 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -236,9 +236,29 @@ static std::string stripExportInterface(const std::string &input, std::string::size_type pos = 0; std::string::size_type lastPos = pos; - while((pos = input.find("$<BUILD_INTERFACE:", lastPos)) != input.npos - || (pos = input.find("$<INSTALL_INTERFACE:", lastPos)) != input.npos) + while (true) { + std::string::size_type bPos = input.find("$<BUILD_INTERFACE:", lastPos); + std::string::size_type iPos = input.find("$<INSTALL_INTERFACE:", lastPos); + + if (bPos == std::string::npos && iPos == std::string::npos) + { + break; + } + + if (bPos == std::string::npos) + { + pos = iPos; + } + else if (iPos == std::string::npos) + { + pos = bPos; + } + else + { + pos = (bPos < iPos) ? bPos : iPos; + } + result += input.substr(lastPos, pos - lastPos); const bool gotInstallInterface = input[pos + 2] == 'I'; pos += gotInstallInterface ? sizeof("$<INSTALL_INTERFACE:") - 1 |