In CMakePresets.json
, I can specify the configurePreset
in both buildPreset
and testPreset
, but I'm not entirely sure what it actually does.
For instance:
{
...
"configurePreset": {
"name": "default",
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"binaryDir": "build",
"warnings": {
"dev": false
},
"cacheVariables": {
"BUILD_TESTING": true
}
},
"buildPreset": {
"name": "debug",
"configurePreset": "default",
"configuration": "Debug",
"jobs": 20
}
...
}
However, the following command won't work:
cmake --build --preset debug
This is because I need to configure the project first.
A build preset derives from the configuration preset a build directory.
Additionally, if you set inheritConfigureEnvironment
flag for the build preset, environment variables will also be inherited.
The same is valid for a test preset: from the configuration preset it unconditionally derives build directory and optionally inherits environment variables.