Stuck with the same problem in a Visual Studio project with CMakePresets.json when I cook it using the example from MSDN: https://learn.microsoft.com/en-us/cpp/build/cmake-presets-vs
I set "CMAKE_BUILD_TYPE": "Release"
in json, but Visual Studio still generates debug builds in this preset (there is no way to additionally set build types inside a preset in GUI):
The reason is still the same: CMAKE_CONFIGURATION_TYPES
with several default values and "Debug" as the first option to be used.
So the solution might be to set only one corresponding CMAKE_CONFIGURATION_TYPES
value inside CMakePresets.json:
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CONFIGURATION_TYPES": "Release"
}