cmComputeLinkInformation: add OBJECT libraries as link items

This completes the transition started in commit b665966933
(cmComputeLinkInformation: track OBJECT library dependencies,
2023-07-22).
This commit is contained in:
Ben Boeckel 2023-07-24 15:12:16 -04:00
parent e166bbef7b
commit 2c7acd34e2
3 changed files with 2 additions and 22 deletions

View File

@ -173,13 +173,7 @@ std::vector<std::string> cmCommonTargetGenerator::GetLinkedTargetDirectories(
this->GeneratorTarget->GetLinkInformation(config)) {
std::vector<cmGeneratorTarget const*> targets;
for (auto const& item : cli->GetItems()) {
targets.push_back(item.Target);
}
for (auto const* target : cli->GetObjectLibrariesLinked()) {
targets.push_back(target);
}
for (auto const* linkee : targets) {
auto const* linkee = item.Target;
if (linkee &&
!linkee->IsImported()
// Skip targets that build after this one in a static lib cycle.

View File

@ -536,12 +536,6 @@ cmComputeLinkInformation::GetSharedLibrariesLinked() const
return this->SharedLibrariesLinked;
}
const std::vector<const cmGeneratorTarget*>&
cmComputeLinkInformation::GetObjectLibrariesLinked() const
{
return this->ObjectLibrariesLinked;
}
bool cmComputeLinkInformation::Compute()
{
// Skip targets that do not link.
@ -1164,12 +1158,7 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry)
this->AddItem(BT<std::string>(libName, item.Backtrace));
}
} else if (tgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (!tgt->HaveCxx20ModuleSources() && !tgt->HaveFortranSources(config)) {
// Ignore object library!
// Its object-files should already have been extracted for linking.
} else {
this->ObjectLibrariesLinked.push_back(entry.Target);
}
this->Items.emplace_back(entry.Item, ItemIsPath::No, entry.Target);
} else if (this->GlobalGenerator->IsXcode() &&
!tgt->GetImportedXcFrameworkPath(config).empty()) {
this->Items.emplace_back(

View File

@ -97,8 +97,6 @@ public:
std::string GetRPathString(bool for_install) const;
std::string GetChrpathString() const;
std::set<cmGeneratorTarget const*> const& GetSharedLibrariesLinked() const;
std::vector<cmGeneratorTarget const*> const& GetObjectLibrariesLinked()
const;
std::vector<cmGeneratorTarget const*> const& GetRuntimeDLLs() const
{
return this->RuntimeDLLs;
@ -136,7 +134,6 @@ private:
std::vector<std::string> XcFrameworkHeaderPaths;
std::vector<std::string> RuntimeSearchPath;
std::set<cmGeneratorTarget const*> SharedLibrariesLinked;
std::vector<cmGeneratorTarget const*> ObjectLibrariesLinked;
std::vector<cmGeneratorTarget const*> RuntimeDLLs;
// Context information.