packaging: Initial packaging
[platform/upstream/cmake.git] / Source / cmTargetDepend.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2010 Kitware, Inc., Insight Software Consortium
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 cmTargetDepend_h
13 #define cmTargetDepend_h
14
15 #include "cmStandardIncludes.h"
16
17 class cmTarget;
18
19 /** One edge in the global target dependency graph.
20     It may be marked as a 'link' or 'util' edge or both.  */
21 class cmTargetDepend
22 {
23   cmTarget* Target;
24
25   // The set order depends only on the Target, so we use
26   // mutable members to acheive a map with set syntax.
27   mutable bool Link;
28   mutable bool Util;
29 public:
30   cmTargetDepend(cmTarget* t): Target(t), Link(false), Util(false) {}
31   operator cmTarget*() const { return this->Target; }
32   cmTarget* operator->() const { return this->Target; }
33   cmTarget& operator*() const { return *this->Target; }
34   friend bool operator < (cmTargetDepend const& l, cmTargetDepend const& r)
35     { return l.Target < r.Target; }
36   void SetType(bool strong) const
37     {
38     if(strong) { this->Util = true; }
39     else { this->Link = true; }
40     }
41   bool IsLink() const { return this->Link; }
42   bool IsUtil() const { return this->Util; }
43 };
44
45 /** Unordered set of (direct) dependencies of a target. */
46 class cmTargetDependSet: public std::set<cmTargetDepend> {};
47
48 #endif