| 182 | } |
| 183 | |
| 184 | cm::optional<cmGeneratorTarget::TransitiveProperty> |
| 185 | cmGeneratorTarget::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 | |
| 228 | cmGeneratorTarget::CustomTransitiveProperty::CustomTransitiveProperty( |
| 229 | std::string interfaceName, UseTo usage) |
no test coverage detected