Error on setting toolset and platform in preset
Simple preset file:
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 26,
"patch": 0
},
"configurePresets": [
{
"name": "preset-test",
"binaryDir": "${sourceDir}/build/preset-test-v143-x64",
"cacheVariables": {
"CMAKE_GENERATOR": "Visual Studio 17 2022",
"CMAKE_CONFIGURATION_TYPES": "Debug;Release",
"CMAKE_GENERATOR_TOOLSET": "v143",
"CMAKE_GENERATOR_PLATFORM": "x64"
}
}
]
}
and CMakeLists.txt
w/ just project()
:
cmake_minimum_required(VERSION 3.26)
project(
preset-bug VERSION 1.0.0
DESCRIPTION "Preset Bug"
LANGUAGES C
)
result in the error:
PS C:\work\tmp\winpreset> cmake --preset preset-test --fresh
Preset CMake variables:
CMAKE_CONFIGURATION_TYPES="Debug;Release"
CMAKE_GENERATOR="Visual Studio 17 2022"
CMAKE_GENERATOR_PLATFORM="x64"
CMAKE_GENERATOR_TOOLSET="v143"
CMake Error: Error: generator platform:
Does not match the platform used previously: x64
Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.
regardless that the build directory didn't exist before the first run.
Also, setting the generator
key instead of the CMAKE_GENERATOR
variable gives the same error.