CMake: Use ninja generator by default
Summary
Change the default generator used in the %cmake macro from make to ninja. Affected projects are tracked in this copr repo, please check if your packages are failing there.
Owner
- Name: Cristian Le
- Email: fedora@lecris.me
Current status
- Targeted release: Fedora Linux 44
- Last updated: 2025-09-01
- Announced
- Discussion thread
- FESCo issue: #3400
- Tracker bug: #2376112
- Release notes tracker: #228
Detailed Description
ninja is generally regarded as a faster build backend/generator than make, and recently CMake features support the ninja backend better. Various packages already define and use the ninja backend manually, and this change proposal would change the build backend to all of the other packages that use the %cmake macro.
Indirect callers to cmake such as when part of python package, would be unaffected and they could implement an equivalent change independently.
Migration
- Make sure you do not use any
%make_installand equivalent in the spec file. Instead use the generator agnostic macros%cmake_build,%cmake_install, etc. - If you need to opt-out of the ninja generator add the following line in the specfile before the
%cmakeexecution
%global _cmake_generator "Unix Makefiles"
Benefit to Fedora
- Faster build system
- Better out-of-the-box support for newer CMake features such as C++ module support
Scope
- Proposal owners:
- Make the
ninjabuild backend be the default - Try to propose appropriate fixes as much as possible
- Investigate the edge-cases that are not covered in Migration
- Make the
- Other developers:
- Adjust the spec file at least with the minimum quick fix. See Migration.
- Release engineering: #Releng issue number
- Policies and guidelines: N/A (not needed for this Change)
Upgrade/compatibility impact
Affected packages would be FTBFS (in the tracked copr repo) and would require patching before the corresponding cmake PR can be merged.
How To Test
A copr repo will be provided with these variables dropped. Use it to try local builds, e.g. using:
copr mock-config lecris/cmake-ninja fedora-rawhide-x86_64
If the build is successful, that should be sufficient.
Dependencies
There are currently 310/2359 packages affected gathered and built using mass-pre-build in copr, many of them are previously FTBFS in rawhide.
Contingency Plan
- Contingency mechanism: N/A (no deadline set)
- Contingency deadline: No deadline necessary yet
- Blocks release? No
