For CMake formatting we use cmake-format
pip install cmakelang
To have format on save in VSCode, you can install the cmake-format extension.
You will then need to update your VSCode settings.json file, to include the following:
"files.associations": {
"CMakeLists.txt": "cmake",
"*.cmake": "cmake"
},
"[cmake]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "cheshirekow.cmake-format"
},