Presets v3 inherited by v2 CMakeUserPresets.json bug
CMakeUserPresets.json v2 cannot inherit from CMakePresets.json v3 unless also valid v2.
Upon investigation in !6353 (closed) is was determined this is a CMake 3.21.0 presets v3 bug.
CMakePresets.json
{
"version": 3,
"configurePresets": [
{
"name": "default"
}
]
}
CMakeUserPresets.json, with above CMakePreset.json fails due to inheriting v3-only "default" preset. Does not fail if I remove "inherits".
{
"version": 2,
"configurePresets": [
{
"name": "new", "inherits": "default",
"generator": "Ninja",
"binaryDir": "build"
}
]
}
This bug was discovered when updating numerous projects CMakePresets.json v2 to v3, while users have untracked CMakeUserPresets.json that were still v2 and inheriting v3 presets, with the users having CMake 3.21.0.
The real-world CMakePresets.json has numerous parameters not relevant to this bug, the minimal case above reproduces the issue with CMake 3.21.0