CMake: Use ninja generator by default
This is a proposed Change for Fedora Linux.
This document represents a proposed Change. As part of the Changes process, proposals are publicly announced in order to receive community feedback. This proposal will only be implemented if approved by the Fedora Engineering Steering Committee.
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
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
Compatibility with fedora releases
Any proposed changes here are compatible with any CMake versions and can be included at any point and backported to any Fedora release.
The corresponding cmake PR will not be merged until the affected packages are patched.
- Make sure you do not use any
%make_install
and 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
%cmake
execution
%global cmake_generator make
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
ninja
build 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-drop_vars 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
Documentation
Release Notes
Last edited by @amoloney 2025-04-16T12:09:57Z
Last edited by @amoloney 2025-04-16T12:09:57Z