diff options
author | Stephen Kelly <steveire@gmail.com> | 2012-10-15 08:27:42 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-10-17 20:23:32 (GMT) |
commit | 79edd00235091475d5b3f1305bcf991cad3e45f4 (patch) | |
tree | b5fdf3e6f79f0ffe275b404a66c9780c6d2800a4 /Source/cmGeneratorExpression.cxx | |
parent | f7ef32b00b8d4fe74bfdcee3e690309e9a89e251 (diff) | |
download | CMake-79edd00235091475d5b3f1305bcf991cad3e45f4.zip CMake-79edd00235091475d5b3f1305bcf991cad3e45f4.tar.gz CMake-79edd00235091475d5b3f1305bcf991cad3e45f4.tar.bz2 |
GenEx: Fix reporting about not-found include directories and libraries.
This fixes a regression introduced in commit 290e92ad (Move
GetIncludeDirectories to cmGeneratorTarget, 2012-09-16) which loops over
cmGeneratorTargets before they get created, so the container is empty.
Diffstat (limited to 'Source/cmGeneratorExpression.cxx')
-rw-r--r-- | Source/cmGeneratorExpression.cxx | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 3f8e962..7d8df37 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -13,6 +13,7 @@ #include "cmMakefile.h" #include "cmTarget.h" +#include "assert.h" #include <cmsys/String.h> @@ -129,3 +130,51 @@ cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression() delete *it; } } + +std::string cmGeneratorExpression::Preprocess(const std::string &input, + PreprocessContext context) +{ + if (context != StripAllGeneratorExpressions) + { + assert(!"cmGeneratorExpression::Preprocess called with invalid args"); + return std::string(); + } + + std::string result; + std::string::size_type pos = 0; + std::string::size_type lastPos = pos; + while((pos = input.find("$<", lastPos)) != input.npos) + { + result += input.substr(lastPos, pos - lastPos); + 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; + } + } + } + const std::string::size_type traversed = (c - cStart) + 1; + if (!*c) + { + result += "$<" + input.substr(pos, traversed); + } + pos += traversed; + lastPos = pos; + } + result += input.substr(lastPos); + return result; +} |