bitcoin-dev

Bitcoin Core's migration to the CMake buildsystem

Bitcoin Core's migration to the CMake buildsystem

Original Postby Cory Fields

Posted on: August 7, 2024 21:47 UTC

Hennadii Stepanov (hebasto) has undertaken the significant task of transitioning Bitcoin Core's build system from Autotools to CMake, a project that has spanned several years and involved extensive review and collaboration.

This effort is notable for its ambition, given the complexities associated with migrating build systems in large software projects, and has led to numerous bug fixes and modernizations not only for Bitcoin Core but also for its dependencies, benefiting the wider open-source community.

The new CMake build system, after thorough review and testing by developers, is poised for integration into the master branch following the v28 feature-freeze and prior to the commencement of work on v29. This transition acknowledges the inevitability of challenges, particularly for those working on less common platforms or configurations, and emphasizes the importance of community feedback during this phase to identify and rectify any issues.

The decision to adopt CMake over other build systems was driven by its suitability for modern, free, and open-source projects, coupled with hebasto’s willingness to spearhead the necessary work. The migration marks a departure from Autotools in the master branch, reflecting a broader preference within the development team to avoid the burdens associated with maintaining parallel build systems for a project as substantial as Bitcoin Core. However, some maintenance of Autotools will continue for older branches despite the primary focus shifting to CMake.

For users and developers interacting with Bitcoin Core, the impact of this change varies. End-users and non-developers are unlikely to notice any difference, whereas developers will need to familiarize themselves with the new build commands and potentially adjust their workflows accordingly. The transition to CMake aims to streamline the build process while requiring explicit opt-ins for features, reducing unexpected behavior by minimizing behind-the-scenes automation.

Documentation and guidance for the new CMake build process have been updated and are available for review. Efforts have been made to ensure feature parity with the previous system, and tools like ccmake can help users navigate the new configuration options. While not all of CMake’s advanced features are supported at this stage, priority has been given to ensuring a robust initial port with a focus on widely used configurations and platforms. Future improvements are expected to address any gaps in functionality and user experience.

The current PR for the CMake migration provides an entry point for those interested in reviewing the changes, offering feedback, or encountering any issues. Contributors are encouraged to engage constructively to facilitate a smooth transition to the new build system.