server
server copied to clipboard
MDEV-36366 - cmake(libfmt): use find_package to find libfmt
Description
TODO: fill description here
This patch improves libfmt detection by calling find_package(fmt QUIET) first when WITH_LIBFMT is set to system or auto. If a system libfmt is located successfully, we skip the custom source-compile snippet. Otherwise, we proceed with the old detection logic (compile test) and finally fall back to the bundled library if needed. This change makes it easier for package managers (e.g., Homebrew) or system environments that already have a modern fmt installed to integrate with MariaDB, without having to override CMake variables manually.
Before this patch, the logic always set CMAKE_REQUIRED_INCLUDES to the bundled copy’s include directory and ran a snippet test, failing if the user had removed or disabled the bundled directory. Now, if a system installation is discoverable via CMake config files, MariaDB can be built cleanly against that library.
Release Notes
- Enhancement: MariaDB can now detect and use system-provided libfmt more reliably when WITH_LIBFMT is system or auto. If find_package(fmt) succeeds, the bundled fallback is skipped, ensuring smoother packaging in environments providing up-to-date versions of libfmt.
No system variables or status variables were changed. No existing behavior changed aside from this improvement in build-time detection of libfmt.
How can this PR be tested?
homebrew PRs
If the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually.
Basing the PR against the correct MariaDB version
- [ ] This is a new feature or a refactoring, and the PR is based against the
mainbranch. - [ ] This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.
PR quality check
- [x] I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
- [x] For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.
relates to:
- https://github.com/Homebrew/homebrew-core/pull/205321
- https://github.com/Homebrew/homebrew-core/pull/205322