summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-07-14 12:42:00 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-07-14 12:42:11 (GMT)
commit802a0aefd55e741ba8864ae4e00154ff1c608bb7 (patch)
tree7058eef90046ac3162219b0695635e968457ac06 /Source
parent278d8ccacba2f4f7612751dea89cb5744923ea4f (diff)
parentf60e92126296c0d87130ea20b9d4680d51fca62d (diff)
downloadCMake-802a0aefd55e741ba8864ae4e00154ff1c608bb7.zip
CMake-802a0aefd55e741ba8864ae4e00154ff1c608bb7.tar.gz
CMake-802a0aefd55e741ba8864ae4e00154ff1c608bb7.tar.bz2
Merge topic 'find_library-simplify-regex'
f60e921262 find_library: Improve regex readability in --debug-find output Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8618
Diffstat (limited to 'Source')
-rw-r--r--Source/cmFindLibraryCommand.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 9eb0603..6a571b4 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -251,8 +251,14 @@ struct cmFindLibraryHelper
void DebugLibraryFailed(std::string const& name, std::string const& path)
{
if (this->DebugMode) {
- auto regexName =
- cmStrCat(this->PrefixRegexStr, name, this->SuffixRegexStr);
+ // To improve readability of the debug output, if there is only one
+ // prefix/suffix, use the plain prefix/suffix instead of the regex.
+ const auto& prefix = (this->Prefixes.size() == 1) ? this->Prefixes[0]
+ : this->PrefixRegexStr;
+ const auto& suffix = (this->Suffixes.size() == 1) ? this->Suffixes[0]
+ : this->SuffixRegexStr;
+
+ auto regexName = cmStrCat(prefix, name, suffix);
this->DebugSearches.FailedAt(path, regexName);
}
}