resolve cyclic dependency with zstd
[platform/upstream/cmake.git] / Source / cmTargetDepend.h
1 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2    file Copyright.txt or https://cmake.org/licensing for details.  */
3 #pragma once
4
5 #include "cmConfigure.h" // IWYU pragma: keep
6
7 #include <set>
8
9 #include "cmListFileCache.h"
10
11 class cmGeneratorTarget;
12
13 /** One edge in the global target dependency graph.
14     It may be marked as a 'link' or 'util' edge or both.  */
15 class cmTargetDepend
16 {
17   cmGeneratorTarget const* Target;
18
19   // The set order depends only on the Target, so we use
20   // mutable members to achieve a map with set syntax.
21   mutable bool Link = false;
22   mutable bool Util = false;
23   mutable bool Cross = false;
24   mutable cmListFileBacktrace Backtrace;
25
26 public:
27   cmTargetDepend(cmGeneratorTarget const* t)
28     : Target(t)
29   {
30   }
31   operator cmGeneratorTarget const*() const { return this->Target; }
32   cmGeneratorTarget const* operator->() const { return this->Target; }
33   cmGeneratorTarget const& operator*() const { return *this->Target; }
34   friend bool operator<(cmTargetDepend const& l, cmTargetDepend const& r)
35   {
36     return l.Target < r.Target;
37   }
38   void SetType(bool strong) const
39   {
40     if (strong) {
41       this->Util = true;
42     } else {
43       this->Link = true;
44     }
45   }
46   void SetCross(bool cross) const { this->Cross = cross; }
47   void SetBacktrace(cmListFileBacktrace const& bt) const
48   {
49     this->Backtrace = bt;
50   }
51   bool IsLink() const { return this->Link; }
52   bool IsUtil() const { return this->Util; }
53   bool IsCross() const { return this->Cross; }
54   cmListFileBacktrace const& GetBacktrace() const { return this->Backtrace; }
55 };
56
57 /** Unordered set of (direct) dependencies of a target. */
58 class cmTargetDependSet : public std::set<cmTargetDepend>
59 {
60 };