From 33f629184fab88290274854595e44261f5a6dd2d Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 28 Jan 2023 11:01:29 -0500 Subject: cmTarget: simplify `CheckLinkLibraryPattern` Now that usage properties have more of a representation, the function can just take the requirement directly. --- Source/cmTarget.cxx | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e5bda26..734c91b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1984,8 +1984,7 @@ void cmTarget::AppendBuildInterfaceIncludes() } namespace { -bool CheckLinkLibraryPattern(cm::string_view property, - const std::vector>& value, +bool CheckLinkLibraryPattern(UsageRequirementProperty const& usage, cmake* context) { // Look for and internal tags @@ -1994,7 +1993,7 @@ bool CheckLinkLibraryPattern(cm::string_view property, bool isValid = true; - for (const auto& item : value) { + for (const auto& item : usage.Entries) { if (!linkPattern.find(item.Value)) { continue; } @@ -2005,8 +2004,8 @@ bool CheckLinkLibraryPattern(cm::string_view property, context->IssueMessage( MessageType::FATAL_ERROR, cmStrCat( - "Property ", property, " contains the invalid item \"", - linkPattern.match(2), "\". The ", property, + "Property ", usage.Name, " contains the invalid item \"", + linkPattern.match(2), "\". The ", usage.Name, " property may contain the generator-expression \"$\" which may be used to specify how the libraries are linked."), @@ -2025,16 +2024,12 @@ void cmTarget::FinalizeTargetConfiguration( return; } - if (!CheckLinkLibraryPattern("LINK_LIBRARIES"_s, - this->impl->LinkLibraries.Entries, + if (!CheckLinkLibraryPattern(this->impl->LinkLibraries, this->GetMakefile()->GetCMakeInstance()) || - !CheckLinkLibraryPattern("INTERFACE_LINK_LIBRARIES"_s, - this->impl->InterfaceLinkLibraries.Entries, + !CheckLinkLibraryPattern(this->impl->InterfaceLinkLibraries, this->GetMakefile()->GetCMakeInstance()) || - !CheckLinkLibraryPattern( - "INTERFACE_LINK_LIBRARIES_DIRECT"_s, - this->impl->InterfaceLinkLibrariesDirect.Entries, - this->GetMakefile()->GetCMakeInstance())) { + !CheckLinkLibraryPattern(this->impl->InterfaceLinkLibrariesDirect, + this->GetMakefile()->GetCMakeInstance())) { return; } -- cgit v0.12