cmTargetDepend.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmTargetDepend_h
  4. #define cmTargetDepend_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <set>
  7. class cmGeneratorTarget;
  8. /** One edge in the global target dependency graph.
  9. It may be marked as a 'link' or 'util' edge or both. */
  10. class cmTargetDepend
  11. {
  12. cmGeneratorTarget const* Target;
  13. // The set order depends only on the Target, so we use
  14. // mutable members to achieve a map with set syntax.
  15. mutable bool Link;
  16. mutable bool Util;
  17. public:
  18. cmTargetDepend(cmGeneratorTarget const* t)
  19. : Target(t)
  20. , Link(false)
  21. , Util(false)
  22. {
  23. }
  24. operator cmGeneratorTarget const*() const { return this->Target; }
  25. cmGeneratorTarget const* operator->() const { return this->Target; }
  26. cmGeneratorTarget const& operator*() const { return *this->Target; }
  27. friend bool operator<(cmTargetDepend l, cmTargetDepend r)
  28. {
  29. return l.Target < r.Target;
  30. }
  31. void SetType(bool strong) const
  32. {
  33. if (strong) {
  34. this->Util = true;
  35. } else {
  36. this->Link = true;
  37. }
  38. }
  39. bool IsLink() const { return this->Link; }
  40. bool IsUtil() const { return this->Util; }
  41. };
  42. /** Unordered set of (direct) dependencies of a target. */
  43. class cmTargetDependSet : public std::set<cmTargetDepend>
  44. {
  45. };
  46. #endif