MCPcopy Create free account
hub / github.com/Kitware/CMake / MaybeHaveInterfaceProperty

Method MaybeHaveInterfaceProperty

Source/cmGeneratorTarget_TransitiveProperty.cxx:64–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62 };
63
64bool cmGeneratorTarget::MaybeHaveInterfaceProperty(std::string const& prop,
65 cm::GenEx::Evaluation* eval,
66 UseTo usage) const
67{
68 std::string const key = cmStrCat(prop, '@', eval->Context.Config);
69 auto i = this->MaybeInterfacePropertyExists.find(key);
70 if (i == this->MaybeInterfacePropertyExists.end()) {
71 // Insert an entry now in case there is a cycle.
72 i = this->MaybeInterfacePropertyExists.emplace(key, false).first;
73 bool& maybeInterfaceProp = i->second;
74
75 // If this target itself has a non-empty property value, we are done.
76 maybeInterfaceProp = cmNonempty(this->GetProperty(prop));
77
78 // Otherwise, recurse to interface dependencies.
79 if (!maybeInterfaceProp) {
80 cmGeneratorTarget const* headTarget =
81 eval->HeadTarget ? eval->HeadTarget : this;
82 if (cmLinkInterfaceLibraries const* iface =
83 this->GetLinkInterfaceLibraries(eval->Context.Config, headTarget,
84 usage)) {
85 if (iface->HadHeadSensitiveCondition) {
86 // With a different head target we may get to a library with
87 // this interface property.
88 maybeInterfaceProp = true;
89 } else {
90 // The transitive interface libraries do not depend on the
91 // head target, so we can follow them.
92 for (cmLinkItem const& lib : iface->Libraries) {
93 if (lib.Target &&
94 lib.Target->MaybeHaveInterfaceProperty(prop, eval, usage)) {
95 maybeInterfaceProp = true;
96 break;
97 }
98 }
99 }
100 }
101 }
102 }
103 return i->second;
104}
105
106std::string cmGeneratorTarget::EvaluateInterfaceProperty(
107 std::string const& prop, cm::GenEx::Evaluation* eval,

Callers 1

Calls 7

GetPropertyMethod · 0.95
cmNonemptyFunction · 0.85
emplaceMethod · 0.80
cmStrCatFunction · 0.70
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected