mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-12 12:30:08 -05:00
cmComputeDepends::LinkEntry: introduce enum to specify item type
This commit is contained in:
@@ -395,9 +395,11 @@ std::pair<int, bool> cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item)
|
|||||||
LinkEntry& entry = this->EntryList[index];
|
LinkEntry& entry = this->EntryList[index];
|
||||||
entry.Item = BT<std::string>(item.AsStr(), item.Backtrace);
|
entry.Item = BT<std::string>(item.AsStr(), item.Backtrace);
|
||||||
entry.Target = item.Target;
|
entry.Target = item.Target;
|
||||||
entry.IsFlag = (!entry.Target && entry.Item.Value[0] == '-' &&
|
if (!entry.Target && entry.Item.Value[0] == '-' &&
|
||||||
entry.Item.Value[1] != 'l' &&
|
entry.Item.Value[1] != 'l' &&
|
||||||
entry.Item.Value.substr(0, 10) != "-framework");
|
entry.Item.Value.substr(0, 10) != "-framework") {
|
||||||
|
entry.Kind = LinkEntry::Flag;
|
||||||
|
}
|
||||||
|
|
||||||
// If the item has dependencies queue it to follow them.
|
// If the item has dependencies queue it to follow them.
|
||||||
if (entry.Target) {
|
if (entry.Target) {
|
||||||
@@ -411,7 +413,7 @@ std::pair<int, bool> cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item)
|
|||||||
// The item dependencies are known. Follow them.
|
// The item dependencies are known. Follow them.
|
||||||
BFSEntry qe = { index, val->c_str() };
|
BFSEntry qe = { index, val->c_str() };
|
||||||
this->BFSQueue.push(qe);
|
this->BFSQueue.push(qe);
|
||||||
} else if (!entry.IsFlag) {
|
} else if (entry.Kind != LinkEntry::Flag) {
|
||||||
// The item dependencies are not known. We need to infer them.
|
// The item dependencies are not known. We need to infer them.
|
||||||
this->InferredDependSets[index].Initialized = true;
|
this->InferredDependSets[index].Initialized = true;
|
||||||
}
|
}
|
||||||
@@ -434,7 +436,7 @@ void cmComputeLinkDepends::AddLinkObject(cmLinkItem const& item)
|
|||||||
int index = lei.first->second;
|
int index = lei.first->second;
|
||||||
LinkEntry& entry = this->EntryList[index];
|
LinkEntry& entry = this->EntryList[index];
|
||||||
entry.Item = BT<std::string>(item.AsStr(), item.Backtrace);
|
entry.Item = BT<std::string>(item.AsStr(), item.Backtrace);
|
||||||
entry.IsObject = true;
|
entry.Kind = LinkEntry::Object;
|
||||||
|
|
||||||
// Record explicitly linked object files separately.
|
// Record explicitly linked object files separately.
|
||||||
this->ObjectEntries.emplace_back(index);
|
this->ObjectEntries.emplace_back(index);
|
||||||
@@ -521,7 +523,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
|
|||||||
// This item was added specifically because it is a dependent
|
// This item was added specifically because it is a dependent
|
||||||
// shared library. It may get special treatment
|
// shared library. It may get special treatment
|
||||||
// in cmComputeLinkInformation.
|
// in cmComputeLinkInformation.
|
||||||
entry.IsSharedDep = true;
|
entry.Kind = LinkEntry::SharedDep;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the link entry for this target.
|
// Get the link entry for this target.
|
||||||
@@ -734,7 +736,7 @@ void cmComputeLinkDepends::AddLinkEntries(int depender_index,
|
|||||||
// items are outside libraries that should not be depending on
|
// items are outside libraries that should not be depending on
|
||||||
// targets.
|
// targets.
|
||||||
if (!this->EntryList[dependee_index].Target &&
|
if (!this->EntryList[dependee_index].Target &&
|
||||||
!this->EntryList[dependee_index].IsFlag &&
|
this->EntryList[dependee_index].Kind != LinkEntry::Flag &&
|
||||||
dependee_index != dependSet.first) {
|
dependee_index != dependSet.first) {
|
||||||
dependSet.second.insert(dependee_index);
|
dependSet.second.insert(dependee_index);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,11 +49,17 @@ public:
|
|||||||
|
|
||||||
static const std::string DEFAULT;
|
static const std::string DEFAULT;
|
||||||
|
|
||||||
|
enum EntryKind
|
||||||
|
{
|
||||||
|
Library,
|
||||||
|
Object,
|
||||||
|
SharedDep,
|
||||||
|
Flag
|
||||||
|
};
|
||||||
|
|
||||||
BT<std::string> Item;
|
BT<std::string> Item;
|
||||||
cmGeneratorTarget const* Target = nullptr;
|
cmGeneratorTarget const* Target = nullptr;
|
||||||
bool IsSharedDep = false;
|
EntryKind Kind = Library;
|
||||||
bool IsFlag = false;
|
|
||||||
bool IsObject = false;
|
|
||||||
// The following member is for the management of items specified
|
// The following member is for the management of items specified
|
||||||
// through genex $<LINK_LIBRARY:...>
|
// through genex $<LINK_LIBRARY:...>
|
||||||
std::string Feature = std::string(DEFAULT);
|
std::string Feature = std::string(DEFAULT);
|
||||||
|
|||||||
@@ -571,7 +571,7 @@ bool cmComputeLinkInformation::Compute()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linkEntry.IsSharedDep) {
|
if (linkEntry.Kind == cmComputeLinkDepends::LinkEntry::SharedDep) {
|
||||||
this->AddSharedDepItem(linkEntry);
|
this->AddSharedDepItem(linkEntry);
|
||||||
} else {
|
} else {
|
||||||
this->AddItem(linkEntry);
|
this->AddItem(linkEntry);
|
||||||
@@ -1521,7 +1521,9 @@ void cmComputeLinkInformation::AddFullItem(LinkEntry const& entry)
|
|||||||
item, ItemIsPath::Yes, nullptr,
|
item, ItemIsPath::Yes, nullptr,
|
||||||
this->FindLibraryFeature(
|
this->FindLibraryFeature(
|
||||||
entry.Feature == DEFAULT
|
entry.Feature == DEFAULT
|
||||||
? (entry.IsObject ? "__CMAKE_LINK_OBJECT" : "__CMAKE_LINK_LIBRARY")
|
? (entry.Kind == cmComputeLinkDepends::LinkEntry::Object
|
||||||
|
? "__CMAKE_LINK_OBJECT"
|
||||||
|
: "__CMAKE_LINK_LIBRARY")
|
||||||
: entry.Feature));
|
: entry.Feature));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user