Maintaining good build configurations with presets
A common problem when building software with CMake is how to share good or working configurations to build a project. Often, people and teams have a preferred way of where the build artifacts should go, which generator to use on which platform, or just the desire that the CI environment should use the same settings to build as they do locally. Since CMake 3.19 came out in December 2020, this information can be stored in CMakePresets.json
files, which are placed in the root directory of a project. Additionally, each user can superimpose their configuration with a CMakeUserPresets.json
file. The basic presets are usually placed under version control, but the user presets are not checked into the version system. Both files follow the same JSON format, with the top-level outline being as follows:
{ "version": 6, "cmakeMinimumRequired": { "major": 3, "minor": 23, "patch": 0 }, "configurePresets...