diff options
author | Thomas Schenker <thomas.schenker@protonmail.com> | 2023-07-07 17:42:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-07-13 13:48:35 (GMT) |
commit | f60e92126296c0d87130ea20b9d4680d51fca62d (patch) | |
tree | 26869eaa516b807d50b2ae94a58888837bd2b33a /Source/cmFindLibraryCommand.cxx | |
parent | b8b53db1b30d697980bbf361a3f2604e1ff8396b (diff) | |
download | CMake-f60e92126296c0d87130ea20b9d4680d51fca62d.zip CMake-f60e92126296c0d87130ea20b9d4680d51fca62d.tar.gz CMake-f60e92126296c0d87130ea20b9d4680d51fca62d.tar.bz2 |
find_library: Improve regex readability in --debug-find output
If there is only one possible library prefix/suffix, omit the capture
group around it in the debug output.
Diffstat (limited to 'Source/cmFindLibraryCommand.cxx')
-rw-r--r-- | Source/cmFindLibraryCommand.cxx | 10 |
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); } } |