|
|
@@ -33,6 +33,7 @@
|
|
|
#include "cmState.h"
|
|
|
#include "cmStateTypes.h"
|
|
|
#include "cmStringAlgorithms.h"
|
|
|
+#include "cmSystemTools.h"
|
|
|
#include "cmTarget.h"
|
|
|
#include "cmValue.h"
|
|
|
#include "cmake.h"
|
|
|
@@ -540,7 +541,22 @@ private:
|
|
|
{
|
|
|
for (auto index : libEntries) {
|
|
|
LinkEntry const& entry = this->Entries[index];
|
|
|
- if (this->IncludeEntry(entry) || this->Emitted.insert(index).second) {
|
|
|
+ if (this->IncludeEntry(entry)) {
|
|
|
+ this->FinalEntries.emplace_back(entry);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (entry.Target && entry.Target->IsImported()) {
|
|
|
+ // Different imported targets can point to the same library so check
|
|
|
+ // also library paths
|
|
|
+ if (this->Emitted.insert(index).second &&
|
|
|
+ this->ImportedEmitted
|
|
|
+ .insert(cmSystemTools::GetRealPath(entry.Item.Value))
|
|
|
+ .second) {
|
|
|
+ this->FinalEntries.emplace_back(entry);
|
|
|
+ }
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (this->Emitted.insert(index).second) {
|
|
|
this->FinalEntries.emplace_back(entry);
|
|
|
}
|
|
|
}
|
|
|
@@ -553,6 +569,7 @@ private:
|
|
|
EntryVector& Entries;
|
|
|
EntryVector& FinalEntries;
|
|
|
std::set<size_t> Emitted;
|
|
|
+ std::set<std::string> ImportedEmitted;
|
|
|
const std::map<size_t, std::vector<size_t>>* Groups = nullptr;
|
|
|
};
|
|
|
}
|