diff options
-rw-r--r-- | Source/cmGeneratorExpressionDAGChecker.cxx | 26 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionDAGChecker.h | 4 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 6 |
3 files changed, 35 insertions, 1 deletions
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index bcb0820..b9069ef 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -24,7 +24,33 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( : Parent(parent), Target(target), Property(property), Content(content), Backtrace(backtrace) { + const cmGeneratorExpressionDAGChecker *top = this; + const cmGeneratorExpressionDAGChecker *p = this->Parent; + while (p) + { + top = p; + p = p->Parent; + } this->CheckResult = this->checkGraph(); + + if (CheckResult == DAG && (top->Property == "INCLUDE_DIRECTORIES" + || top->Property == "COMPILE_DEFINITIONS") ) + { + std::map<cmStdString, std::set<cmStdString> >::const_iterator it + = top->Seen.find(target); + if (it != top->Seen.end()) + { + const std::set<cmStdString> &propSet = it->second; + const std::set<cmStdString>::const_iterator i = propSet.find(property); + if (i != propSet.end()) + { + this->CheckResult = ALREADY_SEEN; + return; + } + } + const_cast<cmGeneratorExpressionDAGChecker *>(top) + ->Seen[target].insert(property); + } } //---------------------------------------------------------------------------- diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h index 7e9c62a..a2e5ce4 100644 --- a/Source/cmGeneratorExpressionDAGChecker.h +++ b/Source/cmGeneratorExpressionDAGChecker.h @@ -28,7 +28,8 @@ struct cmGeneratorExpressionDAGChecker enum Result { DAG, SELF_REFERENCE, - CYCLIC_REFERENCE + CYCLIC_REFERENCE, + ALREADY_SEEN }; Result check() const; @@ -47,6 +48,7 @@ private: const cmGeneratorExpressionDAGChecker * const Parent; const std::string Target; const std::string Property; + std::map<cmStdString, std::set<cmStdString> > Seen; const GeneratorExpressionContent * const Content; const cmListFileBacktrace Backtrace; Result CheckResult; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index cbea1d9..cd4b7d8 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -435,6 +435,9 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE: // No error. We just skip cyclic references. return std::string(); + case cmGeneratorExpressionDAGChecker::ALREADY_SEEN: + // No error. We're not going to find anything new here. + return std::string(); case cmGeneratorExpressionDAGChecker::DAG: break; } @@ -705,6 +708,9 @@ private: case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE: // No error. We just skip cyclic references. return std::string(); + case cmGeneratorExpressionDAGChecker::ALREADY_SEEN: + // No error. We're not going to find anything new here. + return std::string(); case cmGeneratorExpressionDAGChecker::DAG: break; } |