Using CMake presets
While building software on a multitude of configurations, compilers, and platforms is CMake's greatest strength, it is also one of its greatest weaknesses as this often makes it hard for a programmer to figure out which build setups have actually been tested and are working for a given piece of software. Since version 3.19, CMake has a feature called presets that lets us handle these scenarios in a reliable and convenient way. Earlier, developers had to rely on documentation and fuzzy conventions to figure out the preferred configuration of a CMake project. Presets can specify the build directory, generators to use, target architecture, host toolchain, cache variables, and environment variables to use with a project. Since CMake 3.20, there are additional presets that affect the build and test phases as well.
For using presets, the top directory of a project must contain a file named either CMakePresets.json
or CMakeUserPresets.json
. If both files are present...