cmake/Source/cmTargetDepend.h

55 lines
1.4 KiB
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2011-01-16 11:35:12 +01:00
#ifndef cmTargetDepend_h
#define cmTargetDepend_h
2016-10-30 18:24:19 +01:00
#include <cmConfigure.h>
2011-01-16 11:35:12 +01:00
#include "cmStandardIncludes.h"
2015-11-17 17:22:37 +01:00
class cmGeneratorTarget;
2011-01-16 11:35:12 +01:00
/** One edge in the global target dependency graph.
It may be marked as a 'link' or 'util' edge or both. */
class cmTargetDepend
{
2015-11-17 17:22:37 +01:00
cmGeneratorTarget const* Target;
2011-01-16 11:35:12 +01:00
// The set order depends only on the Target, so we use
// mutable members to acheive a map with set syntax.
mutable bool Link;
mutable bool Util;
2016-07-09 11:21:54 +02:00
2011-01-16 11:35:12 +01:00
public:
2015-11-17 17:22:37 +01:00
cmTargetDepend(cmGeneratorTarget const* t)
2016-07-09 11:21:54 +02:00
: Target(t)
, Link(false)
, Util(false)
{
}
2015-11-17 17:22:37 +01:00
operator cmGeneratorTarget const*() const { return this->Target; }
cmGeneratorTarget const* operator->() const { return this->Target; }
cmGeneratorTarget const& operator*() const { return *this->Target; }
2016-07-09 11:21:54 +02:00
friend bool operator<(cmTargetDepend const& l, cmTargetDepend const& r)
{
return l.Target < r.Target;
}
2011-01-16 11:35:12 +01:00
void SetType(bool strong) const
2016-07-09 11:21:54 +02:00
{
if (strong) {
this->Util = true;
} else {
this->Link = true;
2011-01-16 11:35:12 +01:00
}
2016-07-09 11:21:54 +02:00
}
2011-01-16 11:35:12 +01:00
bool IsLink() const { return this->Link; }
bool IsUtil() const { return this->Util; }
};
/** Unordered set of (direct) dependencies of a target. */
2016-07-09 11:21:54 +02:00
class cmTargetDependSet : public std::set<cmTargetDepend>
{
};
2011-01-16 11:35:12 +01:00
#endif