diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-01-28 16:01:29 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-01-31 15:07:02 (GMT) |
commit | 33f629184fab88290274854595e44261f5a6dd2d (patch) | |
tree | e052a15fc72b950c09e8f5c15d2d213805f25f6c | |
parent | 22b9ce73e76f75c594329e7ca44f2a75bc7ffcbf (diff) | |
download | CMake-33f629184fab88290274854595e44261f5a6dd2d.zip CMake-33f629184fab88290274854595e44261f5a6dd2d.tar.gz CMake-33f629184fab88290274854595e44261f5a6dd2d.tar.bz2 |
cmTarget: simplify `CheckLinkLibraryPattern`
Now that usage properties have more of a representation, the function
can just take the requirement directly.
-rw-r--r-- | Source/cmTarget.cxx | 21 |
1 files 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<BT<std::string>>& value, +bool CheckLinkLibraryPattern(UsageRequirementProperty const& usage, cmake* context) { // Look for <LINK_LIBRARY:> and </LINK_LIBRARY:> 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 \"$<LINK_", linkPattern.match(3), ":...>\" 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; } |