diff options
-rw-r--r-- | Source/cmCommonTargetGenerator.cxx | 12 | ||||
-rw-r--r-- | Source/cmComputeLinkInformation.cxx | 14 | ||||
-rw-r--r-- | Source/cmComputeLinkInformation.h | 3 |
3 files changed, 24 insertions, 5 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index e635dd9..1924235 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -170,9 +170,15 @@ std::vector<std::string> cmCommonTargetGenerator::GetLinkedTargetDirectories( cmGlobalCommonGenerator* const gg = this->GlobalCommonGenerator; if (cmComputeLinkInformation* cli = this->GeneratorTarget->GetLinkInformation(config)) { - cmComputeLinkInformation::ItemVector const& items = cli->GetItems(); - for (auto const& item : items) { - cmGeneratorTarget const* linkee = item.Target; + 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) { if (linkee && !linkee->IsImported() // Skip targets that build after this one in a static lib cycle. diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index b80b3cb..ebbb88f 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -525,6 +525,12 @@ 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. @@ -1147,8 +1153,12 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry) this->AddItem(BT<std::string>(libName, item.Backtrace)); } } else if (tgt->GetType() == cmStateEnums::OBJECT_LIBRARY) { - // Ignore object library! - // Its object-files should already have been extracted for linking. + 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); + } } else { // Decide whether to use an import library. cmStateEnums::ArtifactType artifact = tgt->HasImportLibrary(config) diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index a4ada1f..8393a29 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -96,6 +96,8 @@ 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; @@ -132,6 +134,7 @@ private: std::vector<std::string> FrameworkPaths; std::vector<std::string> RuntimeSearchPath; std::set<cmGeneratorTarget const*> SharedLibrariesLinked; + std::vector<cmGeneratorTarget const*> ObjectLibrariesLinked; std::vector<cmGeneratorTarget const*> RuntimeDLLs; // Context information. |