| 1105 | } |
| 1106 | |
| 1107 | void cmGeneratorTarget::ComputeLinkImplementationLibraries( |
| 1108 | std::string const& config, cmOptionalLinkImplementation& impl, |
| 1109 | UseTo usage) const |
| 1110 | { |
| 1111 | cm::GenEx::Context context(this->LocalGenerator, config, |
| 1112 | this->LinkerLanguage); |
| 1113 | cmLocalGenerator const* lg = this->LocalGenerator; |
| 1114 | cmMakefile const* mf = lg->GetMakefile(); |
| 1115 | cmBTStringRange entryRange = this->Target->GetLinkImplementationEntries(); |
| 1116 | auto const& synthTargetsForConfig = this->Configs[config].SyntheticDeps; |
| 1117 | // Collect libraries directly linked in this configuration. |
| 1118 | for (auto const& entry : entryRange) { |
| 1119 | // Keep this logic in sync with ExpandLinkItems. |
| 1120 | cmGeneratorExpressionDAGChecker dagChecker{ |
| 1121 | this, |
| 1122 | "LINK_LIBRARIES", |
| 1123 | nullptr, |
| 1124 | nullptr, |
| 1125 | context, |
| 1126 | cmListFileBacktrace(), |
| 1127 | cmGeneratorExpressionDAGChecker::ComputingLinkLibraries::Yes, |
| 1128 | }; |
| 1129 | // The $<LINK_ONLY> expression may be used to specify link dependencies |
| 1130 | // that are otherwise excluded from usage requirements. |
| 1131 | if (usage == UseTo::Compile) { |
| 1132 | dagChecker.SetTransitivePropertiesOnly(); |
| 1133 | switch (this->GetPolicyStatusCMP0131()) { |
| 1134 | case cmPolicies::WARN: |
| 1135 | case cmPolicies::OLD: |
| 1136 | break; |
| 1137 | case cmPolicies::NEW: |
| 1138 | dagChecker.SetTransitivePropertiesOnlyCMP0131(); |
| 1139 | break; |
| 1140 | } |
| 1141 | } |
| 1142 | cmGeneratorExpression ge(*this->LocalGenerator->GetCMakeInstance(), |
| 1143 | entry.Backtrace); |
| 1144 | std::unique_ptr<cmCompiledGeneratorExpression> const cge = |
| 1145 | ge.Parse(entry.Value); |
| 1146 | cge->SetEvaluateForBuildsystem(true); |
| 1147 | std::string const& evaluated = cge->Evaluate(context, &dagChecker, this); |
| 1148 | cmList llibs(evaluated); |
| 1149 | if (cge->GetHadHeadSensitiveCondition()) { |
| 1150 | impl.HadHeadSensitiveCondition = true; |
| 1151 | } |
| 1152 | if (cge->GetHadContextSensitiveCondition()) { |
| 1153 | impl.HadContextSensitiveCondition = true; |
| 1154 | } |
| 1155 | if (cge->GetHadLinkLanguageSensitiveCondition()) { |
| 1156 | impl.HadLinkLanguageSensitiveCondition = true; |
| 1157 | } |
| 1158 | |
| 1159 | auto linkFeature = cmLinkItem::DEFAULT; |
| 1160 | for (auto const& lib : llibs) { |
| 1161 | if (auto maybeLinkFeature = ParseLinkFeature(lib)) { |
| 1162 | linkFeature = std::move(*maybeLinkFeature); |
| 1163 | continue; |
| 1164 | } |
no test coverage detected