CMakePresets.json schema is too restrictive
See original GitHub issueBrief Issue Summary
I cannot add the new CMake 3.21 feature “conditions” to the CMakePresets.json without breaking cmake-tools. Or any other feature that might come.
The plugin validates the CMakePresets.json and does not load it. The same issue was seen here https://github.com/microsoft/vscode-cmake-tools/issues/1934, but this Issue is for a more general issue.
Apparent Behaviour
Tooltip:

And no preset found:

Code:
{
"name": "x86_64-windows-user-vs2019-Release",
...
"condition": {
"type": "equals",
"lhs": "$env{VSCMD_ARG_TGT_ARCH}",
"rhs": "x64"
}
},
Expected:
It should leave the validation to cmake.exe. e.g. you could run cmake --list-presets and then offer those shown (this will also implicitly enable the condition feature).
$ set | grep VSCMD_ARG_TGT_ARCH
VSCMD_ARG_TGT_ARCH=x86
$ cmake --list-presets
Available configure presets:
"x86-windows-user-vs2019-Release"
CMake Tools Log
[presetController] Invalid kit contents CMakePresets.json (d:\git\xx\CMakePresets.json):
[presetController] >> /configurePresets/1: should NOT have additional properties
[presetController] >> /configurePresets/2: should NOT have additional properties
Platform and Versions
- Operating System: Windows
- CMake Version: 3.21.0-rc1
- VSCode Version: 1.57.1
- CMake Tools Extension Version: private build. see https://github.com/microsoft/vscode-cmake-tools/issues/1934
- Compiler/Toolchain: VS2019
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Existing presets are not shown · Issue #1934 - GitHub
Brief Issue Summary The plugin does not read existing (and working - tested via cli) presets in CMakePresets.json.
Read more >Healthy Lifestyle Score items - Menzies Institute for Medical Research
bobbrow changed the title CMakePresets.json schema is to restrictive CMakePresets.json schema is too restrictive on 30 July 2021.
Read more >Need a file which stores preset build options - GitLab
json file: CMakeSettings is very painful to use when a project has multiple potential presets, especially when many of them are similar to...
Read more >CMakeUserPresets.json - Microsoft Learn
Schema reference for `CMakePresets.json` and ... It's so the same CMakePresets.json file can be used to drive CMake with Visual Studio, ...
Read more >CMakeSettings.json schema does not allow non-standard ...
The schema used by CMakeSettings.json requires that the configurationType property is set to one of Release, RelWithDebInfo, MinSizerel or Debug.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The recommendation is part of the IDE integration guide: https://cmake.org/cmake/help/latest/guide/ide-integration/index.html#presets
I have also seen this recommendation but cannot find it anymore. Maybe they removed it? Can you link it?