The main motivation is to put all arguments into an declarative config and try to use, e.g.
cmake --preset <script-preset>
in some way.
The potential preset could be an item from top-level “scriptPresets” array, and may looks like:
{
"name": "check-format",
"inherits": []
"hidden": false,
"description": "Run git clang-format for all staged files or check N commits if N_COMMITS is defined",
"script": "${current_list_dir}/cmake/run_clang_format.cmake"
"cmakeArgs": [
{ "N_COMMITS": 15 }
],
"scriptArgs": [
"additional-arg from cmake -P script.cmake -- <additional-arg>"
]
}
I definitely missed some potential generic fields, so this preset example is not complete.
This approach also couldn’t support some macro substitutions related to “configure” mode (source Dir, buildDir, generator and some similar)