diff options
author | Brad King <brad.king@kitware.com> | 2021-12-15 15:50:39 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-12-15 17:29:44 (GMT) |
commit | a84a62e0a748c05f1779c4cd1e022df7d27e0db8 (patch) | |
tree | 4b8e6133eb43b6ede88e40b466f18c115f13f9c7 /Source | |
parent | 029c8f50652415baf4aa3dd96c9a8dc9626ae4ec (diff) | |
download | CMake-a84a62e0a748c05f1779c4cd1e022df7d27e0db8.zip CMake-a84a62e0a748c05f1779c4cd1e022df7d27e0db8.tar.gz CMake-a84a62e0a748c05f1779c4cd1e022df7d27e0db8.tar.bz2 |
cmTarget: Record backtraces for INTERFACE_LINK_LIBRARIES
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmExportTryCompileFileGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 28 | ||||
-rw-r--r-- | Source/cmTarget.h | 2 |
3 files changed, 38 insertions, 2 deletions
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index 4fe92c6..db9b05b 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -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") || diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ebf5bd0..38361cc 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -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())); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index c4314a4..1173f49 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -265,6 +265,8 @@ public: cmBTStringRange GetLinkImplementationEntries() const; + cmBTStringRange GetLinkInterfaceEntries() const; + cmBTStringRange GetHeaderSetsEntries() const; cmBTStringRange GetInterfaceHeaderSetsEntries() const; |