|
|
@@ -208,7 +208,7 @@ bool cmGeneratorTarget::ComputeLinkClosure(std::string const& config,
|
|
|
// secondPass);
|
|
|
cmTargetCollectLinkLanguages linkLangs(this, config, languages, this,
|
|
|
secondPass);
|
|
|
- for (cmLinkImplItem const& lib : impl->Libraries) {
|
|
|
+ for (cmLinkItem const& lib : impl->Libraries) {
|
|
|
linkLangs.Visit(lib);
|
|
|
}
|
|
|
|
|
|
@@ -336,7 +336,7 @@ cmGeneratorTarget::GetLinkImplementationClosure(std::string const& config,
|
|
|
this->GetLinkImplementationLibraries(config, usage);
|
|
|
assert(impl);
|
|
|
|
|
|
- for (cmLinkImplItem const& lib : impl->Libraries) {
|
|
|
+ for (cmLinkItem const& lib : impl->Libraries) {
|
|
|
processILibs(config, this, lib,
|
|
|
this->LocalGenerator->GetGlobalGenerator(), tgts, emitted,
|
|
|
usage);
|
|
|
@@ -384,7 +384,7 @@ void cmGeneratorTarget::CheckLinkLibraries() const
|
|
|
|
|
|
// Check link the implementation for each generated configuration.
|
|
|
for (auto const& impl : this->LinkImplMap) {
|
|
|
- for (cmLinkImplItem const& item : impl.second.Libraries) {
|
|
|
+ for (cmLinkItem const& item : impl.second.Libraries) {
|
|
|
if (!this->VerifyLinkItemColons(LinkItemRole::Implementation, item)) {
|
|
|
return;
|
|
|
}
|
|
|
@@ -686,7 +686,7 @@ void cmGeneratorTarget::ComputeLinkInterface(std::string const& config,
|
|
|
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
|
|
|
cmLinkImplementation const* impl =
|
|
|
this->GetLinkImplementation(config, UseTo::Link, secondPass);
|
|
|
- for (cmLinkImplItem const& lib : impl->Libraries) {
|
|
|
+ for (cmLinkItem const& lib : impl->Libraries) {
|
|
|
if (emitted.insert(lib).second) {
|
|
|
if (lib.Target) {
|
|
|
// This is a runtime dependency on another shared library.
|
|
|
@@ -813,54 +813,31 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
|
|
|
LinkInterfaceField::HeadExclude, iface);
|
|
|
}
|
|
|
|
|
|
-namespace {
|
|
|
-
|
|
|
-template <typename ReturnType>
|
|
|
-ReturnType constructItem(cmGeneratorTarget* target,
|
|
|
- cmListFileBacktrace const& bt);
|
|
|
-
|
|
|
-template <>
|
|
|
-inline cmLinkImplItem constructItem(cmGeneratorTarget* target,
|
|
|
- cmListFileBacktrace const& bt)
|
|
|
-{
|
|
|
- return cmLinkImplItem(cmLinkItem(target, false, bt));
|
|
|
-}
|
|
|
-
|
|
|
-template <>
|
|
|
-inline cmLinkItem constructItem(cmGeneratorTarget* target,
|
|
|
- cmListFileBacktrace const& bt)
|
|
|
-{
|
|
|
- return cmLinkItem(target, false, bt);
|
|
|
-}
|
|
|
-
|
|
|
-template <typename ValueType>
|
|
|
-std::vector<ValueType> computeImplicitLanguageTargets(
|
|
|
- std::string const& lang, std::string const& config,
|
|
|
- cmGeneratorTarget const* currentTarget)
|
|
|
+std::vector<cmLinkItem> cmGeneratorTarget::ComputeImplicitLanguageTargets(
|
|
|
+ std::string const& lang, std::string const& config) const
|
|
|
{
|
|
|
cmListFileBacktrace bt;
|
|
|
- std::vector<ValueType> result;
|
|
|
- cmLocalGenerator* lg = currentTarget->GetLocalGenerator();
|
|
|
+ std::vector<cmLinkItem> result;
|
|
|
+ cmLocalGenerator* lg = this->GetLocalGenerator();
|
|
|
|
|
|
std::string const& runtimeLibrary =
|
|
|
- currentTarget->GetRuntimeLinkLibrary(lang, config);
|
|
|
- if (cmValue runtimeLinkOptions = currentTarget->Makefile->GetDefinition(
|
|
|
+ this->GetRuntimeLinkLibrary(lang, config);
|
|
|
+ if (cmValue runtimeLinkOptions = this->Makefile->GetDefinition(
|
|
|
"CMAKE_" + lang + "_RUNTIME_LIBRARIES_" + runtimeLibrary)) {
|
|
|
cmList libsList{ *runtimeLinkOptions };
|
|
|
result.reserve(libsList.size());
|
|
|
|
|
|
for (auto const& i : libsList) {
|
|
|
cmGeneratorTarget::TargetOrString resolved =
|
|
|
- currentTarget->ResolveTargetReference(i, lg);
|
|
|
+ this->ResolveTargetReference(i, lg);
|
|
|
if (resolved.Target) {
|
|
|
- result.emplace_back(constructItem<ValueType>(resolved.Target, bt));
|
|
|
+ result.emplace_back(resolved.Target, false, bt);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
void cmGeneratorTarget::ComputeLinkInterfaceRuntimeLibraries(
|
|
|
std::string const& config, cmOptionalLinkInterface& iface) const
|
|
|
@@ -869,9 +846,8 @@ void cmGeneratorTarget::ComputeLinkInterfaceRuntimeLibraries(
|
|
|
if ((lang == "CUDA" || lang == "HIP") &&
|
|
|
iface.LanguageRuntimeLibraries.find(lang) ==
|
|
|
iface.LanguageRuntimeLibraries.end()) {
|
|
|
- auto implicitTargets =
|
|
|
- computeImplicitLanguageTargets<cmLinkItem>(lang, config, this);
|
|
|
- iface.LanguageRuntimeLibraries[lang] = std::move(implicitTargets);
|
|
|
+ iface.LanguageRuntimeLibraries[lang] =
|
|
|
+ this->ComputeImplicitLanguageTargets(lang, config);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -883,9 +859,8 @@ void cmGeneratorTarget::ComputeLinkImplementationRuntimeLibraries(
|
|
|
if ((lang == "CUDA" || lang == "HIP") &&
|
|
|
impl.LanguageRuntimeLibraries.find(lang) ==
|
|
|
impl.LanguageRuntimeLibraries.end()) {
|
|
|
- auto implicitTargets =
|
|
|
- computeImplicitLanguageTargets<cmLinkImplItem>(lang, config, this);
|
|
|
- impl.LanguageRuntimeLibraries[lang] = std::move(implicitTargets);
|
|
|
+ impl.LanguageRuntimeLibraries[lang] =
|
|
|
+ this->ComputeImplicitLanguageTargets(lang, config);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1093,7 +1068,7 @@ void TransitiveLinkImpl::Follow(cmGeneratorTarget const* target)
|
|
|
void TransitiveLinkImpl::Compute()
|
|
|
{
|
|
|
// Save the original items and start with an empty list.
|
|
|
- std::vector<cmLinkImplItem> original = std::move(this->Impl.Libraries);
|
|
|
+ std::vector<cmLinkItem> original = std::move(this->Impl.Libraries);
|
|
|
|
|
|
// Avoid injecting any original items as usage requirements.
|
|
|
// This gives LINK_LIBRARIES final control over the order
|
|
|
@@ -1101,7 +1076,7 @@ void TransitiveLinkImpl::Compute()
|
|
|
this->Emitted.insert(original.cbegin(), original.cend());
|
|
|
|
|
|
// Process each original item.
|
|
|
- for (cmLinkImplItem& item : original) {
|
|
|
+ for (cmLinkItem& item : original) {
|
|
|
// Inject direct dependencies listed in 'INTERFACE_LINK_LIBRARIES_DIRECT'
|
|
|
// usage requirements before the item itself.
|
|
|
this->Follow(item.Target);
|
|
|
@@ -1114,7 +1089,7 @@ void TransitiveLinkImpl::Compute()
|
|
|
// usage requirements found through any dependency above.
|
|
|
this->Impl.Libraries.erase(
|
|
|
std::remove_if(this->Impl.Libraries.begin(), this->Impl.Libraries.end(),
|
|
|
- [this](cmLinkImplItem const& item) {
|
|
|
+ [this](cmLinkItem const& item) {
|
|
|
return this->Excluded.find(item) != this->Excluded.end();
|
|
|
}),
|
|
|
this->Impl.Libraries.end());
|