mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 23:00:07 -06:00
cmTarget: Record backtraces for INTERFACE_LINK_LIBRARIES
This commit is contained in:
@@ -107,10 +107,16 @@ void cmExportTryCompileFileGenerator::PopulateProperties(
|
||||
const cmGeneratorTarget* target, ImportPropertyMap& properties,
|
||||
std::set<cmGeneratorTarget const*>& emitted)
|
||||
{
|
||||
// Look through all non-special properties.
|
||||
std::vector<std::string> props = target->GetPropertyKeys();
|
||||
// Include special properties that might be relevant here.
|
||||
props.emplace_back("INTERFACE_LINK_LIBRARIES");
|
||||
for (std::string const& p : props) {
|
||||
|
||||
properties[p] = *target->GetProperty(p);
|
||||
cmValue v = target->GetProperty(p);
|
||||
if (!v) {
|
||||
continue;
|
||||
}
|
||||
properties[p] = *v;
|
||||
|
||||
if (cmHasLiteralPrefix(p, "IMPORTED_LINK_INTERFACE_LIBRARIES") ||
|
||||
cmHasLiteralPrefix(p, "IMPORTED_LINK_DEPENDENT_LIBRARIES") ||
|
||||
|
||||
@@ -200,6 +200,7 @@ public:
|
||||
std::vector<BT<std::string>> LinkOptionsEntries;
|
||||
std::vector<BT<std::string>> LinkDirectoriesEntries;
|
||||
std::vector<BT<std::string>> LinkImplementationPropertyEntries;
|
||||
std::vector<BT<std::string>> LinkInterfacePropertyEntries;
|
||||
std::vector<BT<std::string>> HeaderSetsEntries;
|
||||
std::vector<BT<std::string>> InterfaceHeaderSetsEntries;
|
||||
std::vector<std::pair<cmTarget::TLLSignature, cmListFileContext>>
|
||||
@@ -1114,6 +1115,11 @@ cmBTStringRange cmTarget::GetLinkImplementationEntries() const
|
||||
return cmMakeRange(this->impl->LinkImplementationPropertyEntries);
|
||||
}
|
||||
|
||||
cmBTStringRange cmTarget::GetLinkInterfaceEntries() const
|
||||
{
|
||||
return cmMakeRange(this->impl->LinkInterfacePropertyEntries);
|
||||
}
|
||||
|
||||
cmBTStringRange cmTarget::GetHeaderSetsEntries() const
|
||||
{
|
||||
return cmMakeRange(this->impl->HeaderSetsEntries);
|
||||
@@ -1157,6 +1163,7 @@ MAKE_PROP(HEADER_DIRS);
|
||||
MAKE_PROP(HEADER_SET);
|
||||
MAKE_PROP(HEADER_SETS);
|
||||
MAKE_PROP(INTERFACE_HEADER_SETS);
|
||||
MAKE_PROP(INTERFACE_LINK_LIBRARIES);
|
||||
#undef MAKE_PROP
|
||||
}
|
||||
|
||||
@@ -1282,6 +1289,12 @@ void cmTarget::StoreProperty(const std::string& prop, ValueType value)
|
||||
cmListFileBacktrace lfbt = this->impl->Makefile->GetBacktrace();
|
||||
this->impl->LinkImplementationPropertyEntries.emplace_back(value, lfbt);
|
||||
}
|
||||
} else if (prop == propINTERFACE_LINK_LIBRARIES) {
|
||||
this->impl->LinkInterfacePropertyEntries.clear();
|
||||
if (value) {
|
||||
cmListFileBacktrace lfbt = this->impl->Makefile->GetBacktrace();
|
||||
this->impl->LinkInterfacePropertyEntries.emplace_back(value, lfbt);
|
||||
}
|
||||
} else if (prop == propSOURCES) {
|
||||
this->impl->SourceEntries.clear();
|
||||
if (value) {
|
||||
@@ -1535,6 +1548,11 @@ void cmTarget::AppendProperty(const std::string& prop,
|
||||
cmListFileBacktrace lfbt = this->impl->Makefile->GetBacktrace();
|
||||
this->impl->LinkImplementationPropertyEntries.emplace_back(value, lfbt);
|
||||
}
|
||||
} else if (prop == propINTERFACE_LINK_LIBRARIES) {
|
||||
if (!value.empty()) {
|
||||
cmListFileBacktrace lfbt = this->impl->Makefile->GetBacktrace();
|
||||
this->impl->LinkInterfacePropertyEntries.emplace_back(value, lfbt);
|
||||
}
|
||||
} else if (prop == "SOURCES") {
|
||||
cmListFileBacktrace lfbt = this->impl->Makefile->GetBacktrace();
|
||||
this->impl->SourceEntries.emplace_back(value, lfbt);
|
||||
@@ -1844,6 +1862,7 @@ cmValue cmTarget::GetProperty(const std::string& prop) const
|
||||
propHEADER_SET,
|
||||
propHEADER_SETS,
|
||||
propINTERFACE_HEADER_SETS,
|
||||
propINTERFACE_LINK_LIBRARIES,
|
||||
};
|
||||
if (specialProps.count(prop)) {
|
||||
if (prop == propC_STANDARD || prop == propCXX_STANDARD ||
|
||||
@@ -1864,6 +1883,15 @@ cmValue cmTarget::GetProperty(const std::string& prop) const
|
||||
output = cmJoin(this->impl->LinkImplementationPropertyEntries, ";");
|
||||
return cmValue(output);
|
||||
}
|
||||
if (prop == propINTERFACE_LINK_LIBRARIES) {
|
||||
if (this->impl->LinkInterfacePropertyEntries.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static std::string output;
|
||||
output = cmJoin(this->impl->LinkInterfacePropertyEntries, ";");
|
||||
return cmValue(output);
|
||||
}
|
||||
// the type property returns what type the target is
|
||||
if (prop == propTYPE) {
|
||||
return cmValue(cmState::GetTargetTypeName(this->GetType()));
|
||||
|
||||
@@ -265,6 +265,8 @@ public:
|
||||
|
||||
cmBTStringRange GetLinkImplementationEntries() const;
|
||||
|
||||
cmBTStringRange GetLinkInterfaceEntries() const;
|
||||
|
||||
cmBTStringRange GetHeaderSetsEntries() const;
|
||||
|
||||
cmBTStringRange GetInterfaceHeaderSetsEntries() const;
|
||||
|
||||
Reference in New Issue
Block a user