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

Method IsTransitiveProperty

Source/cmGeneratorTarget_TransitiveProperty.cxx:184–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184cm::optional<cmGeneratorTarget::TransitiveProperty>
185cmGeneratorTarget::IsTransitiveProperty(
186 cm::string_view prop, cm::GenEx::Context const& context,
187 cmGeneratorExpressionDAGChecker const* dagChecker) const
188{
189 cm::optional<TransitiveProperty> result;
190 static cm::string_view const kINTERFACE_ = "INTERFACE_"_s;
191 PropertyFor const propertyFor = cmHasPrefix(prop, kINTERFACE_)
192 ? PropertyFor::Interface
193 : PropertyFor::Build;
194 if (propertyFor == PropertyFor::Interface) {
195 prop = prop.substr(kINTERFACE_.length());
196 }
197 auto i = BuiltinTransitiveProperties.find(prop);
198 if (i != BuiltinTransitiveProperties.end() &&
199 // Look up CMP0189 in the context where evaluation occurs,
200 // not where the target was created.
201 context.GetCMP0189() != cmPolicies::NEW && prop == "LINK_LIBRARIES"_s) {
202 i = BuiltinTransitiveProperties.end();
203 }
204 if (i != BuiltinTransitiveProperties.end()) {
205 result = i->second;
206 if (result->Usage != cmGeneratorTarget::UseTo::Compile) {
207 cmPolicies::PolicyStatus cmp0166 =
208 context.LG->GetPolicyStatus(cmPolicies::CMP0166);
209 if ((cmp0166 == cmPolicies::WARN || cmp0166 == cmPolicies::OLD) &&
210 (prop == "LINK_DIRECTORIES"_s || prop == "LINK_DEPENDS"_s ||
211 prop == "LINK_OPTIONS"_s)) {
212 result->Usage = cmGeneratorTarget::UseTo::Compile;
213 }
214 }
215 } else if (!ComputingLinkLibraries(dagChecker)) {
216 // Honor TRANSITIVE_COMPILE_PROPERTIES and TRANSITIVE_LINK_PROPERTIES
217 // from the link closure when we are not evaluating the closure itself.
218 CustomTransitiveProperties const& ctp =
219 this->GetCustomTransitiveProperties(context.Config, propertyFor);
220 auto ci = ctp.find(std::string(prop));
221 if (ci != ctp.end()) {
222 result = ci->second;
223 }
224 }
225 return result;
226}
227
228cmGeneratorTarget::CustomTransitiveProperty::CustomTransitiveProperty(
229 std::string interfaceName, UseTo usage)

Callers 2

EvaluateMethod · 0.80

Calls 8

cmHasPrefixFunction · 0.85
lengthMethod · 0.80
GetCMP0189Method · 0.80
ComputingLinkLibrariesFunction · 0.70
substrMethod · 0.45
findMethod · 0.45
endMethod · 0.45
GetPolicyStatusMethod · 0.45

Tested by

no test coverage detected