| 62 | }; |
| 63 | |
| 64 | bool 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 | |
| 106 | std::string cmGeneratorTarget::EvaluateInterfaceProperty( |
| 107 | std::string const& prop, cm::GenEx::Evaluation* eval, |
no test coverage detected