mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-09 15:20:56 -06:00
cmGeneratorExpressionDAGChecker: Simplify finding evaluation graph root
This commit is contained in:
@@ -31,12 +31,13 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
|
||||
std::string property, const GeneratorExpressionContent* content,
|
||||
cmGeneratorExpressionDAGChecker* parent)
|
||||
: Parent(parent)
|
||||
, Top(parent ? parent->Top : this)
|
||||
, Target(target)
|
||||
, Property(std::move(property))
|
||||
, Content(content)
|
||||
, Backtrace(std::move(backtrace))
|
||||
{
|
||||
const auto* top = this->Top();
|
||||
const auto* top = this->Top;
|
||||
this->CheckResult = this->CheckGraph();
|
||||
|
||||
#define TEST_TRANSITIVE_PROPERTY_METHOD(METHOD) top->METHOD() ||
|
||||
@@ -129,13 +130,13 @@ cmGeneratorExpressionDAGChecker::CheckGraph() const
|
||||
|
||||
bool cmGeneratorExpressionDAGChecker::GetTransitivePropertiesOnly() const
|
||||
{
|
||||
return this->Top()->TransitivePropertiesOnly;
|
||||
return this->Top->TransitivePropertiesOnly;
|
||||
}
|
||||
|
||||
bool cmGeneratorExpressionDAGChecker::GetTransitivePropertiesOnlyCMP0131()
|
||||
const
|
||||
{
|
||||
return this->Top()->CMP0131;
|
||||
return this->Top->CMP0131;
|
||||
}
|
||||
|
||||
bool cmGeneratorExpressionDAGChecker::EvaluatingGenexExpression() const
|
||||
@@ -146,12 +147,12 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingGenexExpression() const
|
||||
|
||||
bool cmGeneratorExpressionDAGChecker::EvaluatingPICExpression() const
|
||||
{
|
||||
return this->Top()->Property == "INTERFACE_POSITION_INDEPENDENT_CODE";
|
||||
return this->Top->Property == "INTERFACE_POSITION_INDEPENDENT_CODE";
|
||||
}
|
||||
|
||||
bool cmGeneratorExpressionDAGChecker::EvaluatingCompileExpression() const
|
||||
{
|
||||
cm::string_view property(this->Top()->Property);
|
||||
cm::string_view property(this->Top->Property);
|
||||
|
||||
return property == "INCLUDE_DIRECTORIES"_s ||
|
||||
property == "COMPILE_DEFINITIONS"_s || property == "COMPILE_OPTIONS"_s;
|
||||
@@ -159,7 +160,7 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingCompileExpression() const
|
||||
|
||||
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkExpression() const
|
||||
{
|
||||
cm::string_view property(this->Top()->Property);
|
||||
cm::string_view property(this->Top->Property);
|
||||
|
||||
return property == "LINK_DIRECTORIES"_s || property == "LINK_OPTIONS"_s ||
|
||||
property == "LINK_DEPENDS"_s || property == "LINK_LIBRARY_OVERRIDE"_s ||
|
||||
@@ -168,14 +169,14 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkExpression() const
|
||||
|
||||
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkOptionsExpression() const
|
||||
{
|
||||
cm::string_view property(this->Top()->Property);
|
||||
cm::string_view property(this->Top->Property);
|
||||
|
||||
return property == "LINK_OPTIONS"_s || property == "LINKER_TYPE"_s;
|
||||
}
|
||||
|
||||
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkerLauncher() const
|
||||
{
|
||||
cm::string_view property(this->Top()->Property);
|
||||
cm::string_view property(this->Top->Property);
|
||||
|
||||
return property.length() > cmStrLen("_LINKER_LAUNCHER") &&
|
||||
property.substr(property.length() - cmStrLen("_LINKER_LAUNCHER")) ==
|
||||
@@ -185,7 +186,7 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkerLauncher() const
|
||||
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(
|
||||
cmGeneratorTarget const* tgt, ForGenex genex) const
|
||||
{
|
||||
const auto* top = this->Top();
|
||||
const auto* top = this->Top;
|
||||
|
||||
cm::string_view prop(top->Property);
|
||||
|
||||
@@ -206,21 +207,9 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(
|
||||
: (result || prop == "INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE"_s);
|
||||
}
|
||||
|
||||
cmGeneratorExpressionDAGChecker const* cmGeneratorExpressionDAGChecker::Top()
|
||||
const
|
||||
{
|
||||
const cmGeneratorExpressionDAGChecker* top = this;
|
||||
const cmGeneratorExpressionDAGChecker* parent = this->Parent;
|
||||
while (parent) {
|
||||
top = parent;
|
||||
parent = parent->Parent;
|
||||
}
|
||||
return top;
|
||||
}
|
||||
|
||||
cmGeneratorTarget const* cmGeneratorExpressionDAGChecker::TopTarget() const
|
||||
{
|
||||
return this->Top()->Target;
|
||||
return this->Top->Target;
|
||||
}
|
||||
|
||||
enum class TransitiveProperty
|
||||
|
||||
@@ -94,13 +94,13 @@ struct cmGeneratorExpressionDAGChecker
|
||||
bool GetTransitivePropertiesOnlyCMP0131() const;
|
||||
void SetTransitivePropertiesOnlyCMP0131() { this->CMP0131 = true; }
|
||||
|
||||
cmGeneratorExpressionDAGChecker const* Top() const;
|
||||
cmGeneratorTarget const* TopTarget() const;
|
||||
|
||||
private:
|
||||
Result CheckGraph() const;
|
||||
|
||||
const cmGeneratorExpressionDAGChecker* const Parent;
|
||||
const cmGeneratorExpressionDAGChecker* const Top;
|
||||
cmGeneratorTarget const* Target;
|
||||
const std::string Property;
|
||||
mutable std::map<cmGeneratorTarget const*, std::set<std::string>> Seen;
|
||||
|
||||
Reference in New Issue
Block a user