cmGeneratorExpressionDAGChecker.h 2.4 KB

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