cmake/Source/cmTargetDepend.h

62 lines
1.7 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. */
2021-09-14 00:13:48 +02:00
#pragma once
2011-01-16 11:35:12 +01:00
2017-07-20 19:35:53 +02:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-10-30 18:24:19 +01:00
2017-04-14 19:02:05 +02:00
#include <set>
2011-01-16 11:35:12 +01:00
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
2018-04-23 21:13:27 +02:00
// mutable members to achieve a map with set syntax.
2011-01-16 11:35:12 +01:00
mutable bool Link;
mutable bool Util;
2020-08-30 11:54:41 +02:00
mutable bool Cross;
2019-11-11 23:01:05 +01:00
mutable cmListFileBacktrace Backtrace;
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)
2020-08-30 11:54:41 +02:00
, Cross(false)
2016-07-09 11:21:54 +02:00
{
}
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; }
2020-02-01 23:06:01 +01:00
friend bool operator<(cmTargetDepend const& l, cmTargetDepend const& r)
2016-07-09 11:21:54 +02:00
{
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
}
2020-08-30 11:54:41 +02:00
void SetCross(bool cross) const { this->Cross = cross; }
2019-11-11 23:01:05 +01:00
void SetBacktrace(cmListFileBacktrace const& bt) const
{
this->Backtrace = bt;
}
2011-01-16 11:35:12 +01:00
bool IsLink() const { return this->Link; }
bool IsUtil() const { return this->Util; }
2020-08-30 11:54:41 +02:00
bool IsCross() const { return this->Cross; }
2019-11-11 23:01:05 +01:00
cmListFileBacktrace const& GetBacktrace() const { return this->Backtrace; }
2011-01-16 11:35:12 +01:00
};
/** Unordered set of (direct) dependencies of a target. */
2016-07-09 11:21:54 +02:00
class cmTargetDependSet : public std::set<cmTargetDepend>
{
};