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

Method ComputeLinkClosure

Source/cmGeneratorTarget_Link.cxx:194–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192};
193
194bool cmGeneratorTarget::ComputeLinkClosure(std::string const& config,
195 LinkClosure& lc,
196 bool secondPass) const
197{
198 // Get languages built in this target.
199 std::unordered_set<std::string> languages;
200 cmLinkImplementation const* impl =
201 this->GetLinkImplementation(config, UseTo::Link, secondPass);
202 assert(impl);
203 languages.insert(impl->Languages.cbegin(), impl->Languages.cend());
204
205 // Add interface languages from linked targets.
206 // cmTargetCollectLinkLanguages linkLangs(this, config, languages, this,
207 // secondPass);
208 cmTargetCollectLinkLanguages linkLangs(this, config, languages, this,
209 secondPass);
210 for (cmLinkItem const& lib : impl->Libraries) {
211 linkLangs.Visit(lib);
212 }
213
214 // Store the transitive closure of languages.
215 cm::append(lc.Languages, languages);
216
217 // Choose the language whose linker should be used.
218 if (secondPass || lc.LinkerLanguage.empty()) {
219 // Find the language with the highest preference value.
220 cmTargetSelectLinker tsl(this);
221
222 // First select from the languages compiled directly in this target.
223 for (std::string const& l : impl->Languages) {
224 tsl.Consider(l);
225 }
226
227 // Now consider languages that propagate from linked targets.
228 for (std::string const& lang : languages) {
229 std::string propagates =
230 cmStrCat("CMAKE_", lang, "_LINKER_PREFERENCE_PROPAGATES");
231 if (this->Makefile->IsOn(propagates)) {
232 tsl.Consider(lang);
233 }
234 }
235
236 lc.LinkerLanguage = tsl.Choose();
237 }
238
239 return impl->HadLinkLanguageSensitiveCondition ||
240 linkLangs.GetHadLinkLanguageSensitiveCondition();
241}
242
243void cmGeneratorTarget::ComputeLinkClosure(std::string const& config,
244 LinkClosure& lc) const

Callers 1

GetLinkClosureMethod · 0.95

Calls 15

GetLinkImplementationMethod · 0.95
appendFunction · 0.85
moveFunction · 0.85
cbeginMethod · 0.80
cendMethod · 0.80
VisitMethod · 0.80
ConsiderMethod · 0.80
ChooseMethod · 0.80
strMethod · 0.80
cmStrCatFunction · 0.70
ErrorClass · 0.70
insertMethod · 0.45

Tested by

no test coverage detected