|
@@ -27,6 +27,7 @@
|
|
|
#include "cmMakefile.h"
|
|
|
#include "cmMessageType.h"
|
|
|
#include "cmRange.h"
|
|
|
+#include "cmSourceFile.h"
|
|
|
#include "cmStateTypes.h"
|
|
|
#include "cmStringAlgorithms.h"
|
|
|
#include "cmTarget.h"
|
|
@@ -320,6 +321,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.
|
|
@@ -513,6 +517,7 @@ void cmComputeLinkDepends::AddLinkObject(cmLinkItem const& item)
|
|
|
LinkEntry& entry = this->EntryList[index];
|
|
|
entry.Item = BT<std::string>(item.AsStr(), item.Backtrace);
|
|
|
entry.Kind = LinkEntry::Object;
|
|
|
+ entry.Target = item.Target;
|
|
|
|
|
|
// Record explicitly linked object files separately.
|
|
|
this->ObjectEntries.emplace_back(index);
|
|
@@ -701,6 +706,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)
|