From 22b9ce73e76f75c594329e7ca44f2a75bc7ffcbf Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 28 Jan 2023 11:01:14 -0500 Subject: cmTarget: refactor INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE usage requirements --- Source/cmTarget.cxx | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 629ecb8..e5bda26 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -305,7 +305,6 @@ public: std::map> LanguageStandardProperties; std::map> InstallIncludeDirectoriesEntries; - std::vector> LinkInterfaceDirectExcludePropertyEntries; std::vector> TLLCommands; std::map FileSets; @@ -322,6 +321,7 @@ public: UsageRequirementProperty LinkLibraries; UsageRequirementProperty InterfaceLinkLibraries; UsageRequirementProperty InterfaceLinkLibrariesDirect; + UsageRequirementProperty InterfaceLinkLibrariesDirectExclude; FileSetType HeadersFileSets; FileSetType CxxModulesFileSets; @@ -369,6 +369,8 @@ cmTargetInternals::cmTargetInternals() , LinkLibraries("LINK_LIBRARIES"_s) , InterfaceLinkLibraries("INTERFACE_LINK_LIBRARIES"_s) , InterfaceLinkLibrariesDirect("INTERFACE_LINK_LIBRARIES_DIRECT"_s) + , InterfaceLinkLibrariesDirectExclude( + "INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE"_s) , HeadersFileSets("HEADERS"_s, "HEADER_DIRS"_s, "HEADER_SET"_s, "HEADER_DIRS_"_s, "HEADER_SET_"_s, "Header"_s, "The default header set"_s, "Header set"_s, @@ -1516,7 +1518,7 @@ cmBTStringRange cmTarget::GetLinkInterfaceDirectEntries() const cmBTStringRange cmTarget::GetLinkInterfaceDirectExcludeEntries() const { - return cmMakeRange(this->impl->LinkInterfaceDirectExcludePropertyEntries); + return cmMakeRange(this->impl->InterfaceLinkLibrariesDirectExclude.Entries); } cmBTStringRange cmTarget::GetHeaderSetsEntries() const @@ -1657,6 +1659,7 @@ void cmTarget::StoreProperty(const std::string& prop, ValueType value) &this->impl->LinkLibraries, &this->impl->InterfaceLinkLibraries, &this->impl->InterfaceLinkLibrariesDirect, + &this->impl->InterfaceLinkLibrariesDirectExclude, }; for (auto* usageRequirement : usageRequirements) { @@ -1679,14 +1682,7 @@ void cmTarget::StoreProperty(const std::string& prop, ValueType value) } } - if (prop == propINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE) { - this->impl->LinkInterfaceDirectExcludePropertyEntries.clear(); - if (value) { - cmListFileBacktrace lfbt = this->impl->Makefile->GetBacktrace(); - this->impl->LinkInterfaceDirectExcludePropertyEntries.emplace_back(value, - lfbt); - } - } else if (prop == propIMPORTED_GLOBAL) { + if (prop == propIMPORTED_GLOBAL) { if (!cmIsOn(value)) { std::ostringstream e; e << "IMPORTED_GLOBAL property can't be set to FALSE on targets (\"" @@ -1813,6 +1809,7 @@ void cmTarget::AppendProperty(const std::string& prop, &this->impl->LinkLibraries, &this->impl->InterfaceLinkLibraries, &this->impl->InterfaceLinkLibrariesDirect, + &this->impl->InterfaceLinkLibrariesDirectExclude, }; for (auto* usageRequirement : usageRequirements) { @@ -1835,13 +1832,7 @@ void cmTarget::AppendProperty(const std::string& prop, } } - if (prop == propINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE) { - if (!value.empty()) { - cmListFileBacktrace lfbt = this->impl->GetBacktrace(bt); - this->impl->LinkInterfaceDirectExcludePropertyEntries.emplace_back(value, - lfbt); - } - } else if (cmHasLiteralPrefix(prop, "IMPORTED_LIBNAME")) { + if (cmHasLiteralPrefix(prop, "IMPORTED_LIBNAME")) { this->impl->Makefile->IssueMessage( MessageType::FATAL_ERROR, prop + " property may not be APPENDed."); } else if (prop == "C_STANDARD" || prop == "CXX_STANDARD" || @@ -2283,6 +2274,7 @@ cmValue cmTarget::GetProperty(const std::string& prop) const &this->impl->LinkLibraries, &this->impl->InterfaceLinkLibraries, &this->impl->InterfaceLinkLibrariesDirect, + &this->impl->InterfaceLinkLibrariesDirectExclude, }; for (auto const* usageRequirement : usageRequirements) { @@ -2292,16 +2284,6 @@ cmValue cmTarget::GetProperty(const std::string& prop) const } } - if (prop == propINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE) { - if (this->impl->LinkInterfaceDirectExcludePropertyEntries.empty()) { - return nullptr; - } - - static std::string output; - output = - cmJoin(this->impl->LinkInterfaceDirectExcludePropertyEntries, ";"); - return cmValue(output); - } // the type property returns what type the target is if (prop == propTYPE) { return cmValue(cmState::GetTargetTypeName(this->GetType())); -- cgit v0.12