Imported Upstream version 2.8.11.2
[platform/upstream/cmake.git] / Source / cmGeneratorExpressionDAGChecker.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2012 Stephen Kelly <steveire@gmail.com>
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #ifndef cmGeneratorExpressionDAGChecker_h
13 #define cmGeneratorExpressionDAGChecker_h
14
15 #include "cmStandardIncludes.h"
16
17 #include "cmGeneratorExpressionEvaluator.h"
18
19 //----------------------------------------------------------------------------
20 struct cmGeneratorExpressionDAGChecker
21 {
22   cmGeneratorExpressionDAGChecker(const cmListFileBacktrace &backtrace,
23                                   const std::string &target,
24                                   const std::string &property,
25                                   const GeneratorExpressionContent *content,
26                                   cmGeneratorExpressionDAGChecker *parent);
27
28   enum Result {
29     DAG,
30     SELF_REFERENCE,
31     CYCLIC_REFERENCE,
32     ALREADY_SEEN
33   };
34
35   Result check() const;
36
37   void reportError(cmGeneratorExpressionContext *context,
38                    const std::string &expr);
39
40   bool EvaluatingLinkLibraries();
41   bool EvaluatingIncludeDirectories() const;
42   bool EvaluatingCompileDefinitions() const;
43
44 private:
45   Result checkGraph() const;
46
47 private:
48   const cmGeneratorExpressionDAGChecker * const Parent;
49   const std::string Target;
50   const std::string Property;
51   std::map<cmStdString, std::set<cmStdString> > Seen;
52   const GeneratorExpressionContent * const Content;
53   const cmListFileBacktrace Backtrace;
54   Result CheckResult;
55 };
56
57 #endif