diff options
Diffstat (limited to 'Source/cmComputeLinkDepends.cxx')
-rw-r--r-- | Source/cmComputeLinkDepends.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index ce0df6b..4100135 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -26,6 +26,7 @@ #include "cmMakefile.h" #include "cmMessageType.h" #include "cmRange.h" +#include "cmSourceFile.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmTarget.h" @@ -319,6 +320,9 @@ cmComputeLinkDepends::Compute() // Follow the link dependencies of the target to be linked. this->AddDirectLinkEntries(); + // Add dependencies on targets named by $<TARGET_OBJECTS:...> sources. + this->AddTargetObjectEntries(); + // Complete the breadth-first search of dependencies. while (!this->BFSQueue.empty()) { // Get the next entry. @@ -701,6 +705,21 @@ void cmComputeLinkDepends::AddDirectLinkEntries() } } +void cmComputeLinkDepends::AddTargetObjectEntries() +{ + std::vector<cmSourceFile const*> externalObjects; + this->Target->GetExternalObjects(externalObjects, this->Config); + for (auto const* externalObject : externalObjects) { + std::string const& objLib = externalObject->GetObjectLibrary(); + if (objLib.empty()) { + continue; + } + cmLinkItem const& objItem = + this->Target->ResolveLinkItem(BT<std::string>(objLib)); + this->AddLinkObject(objItem); + } +} + template <typename T> void cmComputeLinkDepends::AddLinkEntries(size_t depender_index, std::vector<T> const& libs) |