Writing a preset file
CMake searches for CMakePresets.json
and CMakeUserPresets.json
in the top-level directory. Both files use the same JSON structure to define presets, hence there isn’t much difference between them to discuss. The format is a JSON object with the following keys:
version
: This is a required integer that specifies the version of the preset JSON schemacmakeMinimumRequired
: This is an object that specifies the required CMake versioninclude
: This is an array of strings that includes external presets from file paths provided in the array (since schema version 4)configurePresets
: This is an array of objects that defines the configuration stage presetsbuildPresets
: This is an array of objects that defines the build stage presetstestPresets
: This is an array of objects that are specific to the test stage presetspackagePresets
: This is an array of objects that are specific to the package stage presetsworkflowPresets...