Updates will be applied on October 27th between 12pm - 12:45pm EDT (UTC-0400). Gitlab may be slow during the maintenance window.

cmGeneratorExpressionDAGChecker.h 2.41 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*============================================================================
  CMake - Cross Platform Makefile Generator
  Copyright 2012 Stephen Kelly <steveire@gmail.com>

  Distributed under the OSI-approved BSD License (the "License");
  see accompanying file Copyright.txt for details.

  This software is distributed WITHOUT ANY WARRANTY; without even the
  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the License for more information.
============================================================================*/
#ifndef cmGeneratorExpressionDAGChecker_h
#define cmGeneratorExpressionDAGChecker_h

#include "cmStandardIncludes.h"

#include "cmGeneratorExpressionEvaluator.h"

19
20
#define CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(F) \
  F(EvaluatingIncludeDirectories) \
21
  F(EvaluatingSystemIncludeDirectories) \
22
23
24
25
  F(EvaluatingCompileDefinitions) \
  F(EvaluatingCompileOptions)

#define CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(F) \
26
27
28
29
  F(INCLUDE_DIRECTORIES) \
  F(SYSTEM_INCLUDE_DIRECTORIES) \
  F(COMPILE_DEFINITIONS) \
  F(COMPILE_OPTIONS)
30

31
32
33
34
35
36
37
38
39
//----------------------------------------------------------------------------
struct cmGeneratorExpressionDAGChecker
{
  cmGeneratorExpressionDAGChecker(const cmListFileBacktrace &backtrace,
                                  const std::string &target,
                                  const std::string &property,
                                  const GeneratorExpressionContent *content,
                                  cmGeneratorExpressionDAGChecker *parent);

40
41
42
  enum Result {
    DAG,
    SELF_REFERENCE,
43
44
    CYCLIC_REFERENCE,
    ALREADY_SEEN
45
46
47
  };

  Result check() const;
48
49
50

  void reportError(cmGeneratorExpressionContext *context,
                   const std::string &expr);
51

52
  bool EvaluatingLinkLibraries(const char *tgt = 0);
53
54
55
56
57

#define DECLARE_TRANSITIVE_PROPERTY_METHOD(METHOD) \
  bool METHOD () const;

CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(DECLARE_TRANSITIVE_PROPERTY_METHOD)
58

59
60
61
62
  bool GetTransitivePropertiesOnly();
  void SetTransitivePropertiesOnly()
    { this->TransitivePropertiesOnly = true; }

63
private:
64
  Result checkGraph() const;
65
66
67
68
69

private:
  const cmGeneratorExpressionDAGChecker * const Parent;
  const std::string Target;
  const std::string Property;
70
  std::map<cmStdString, std::set<cmStdString> > Seen;
71
72
  const GeneratorExpressionContent * const Content;
  const cmListFileBacktrace Backtrace;
73
  Result CheckResult;
74
  bool TransitivePropertiesOnly;
75
76
77
};

#endif