CMakePresets "toolchainFile" field ignored in cmake-gui
When using the cmake-gui, the CMakePresets.json
file below correctly selects and executes the toolchain file toolchain.cmake
:
{
"version": 3,
"cmakeMinimumRequired": { "major": 3, "minor": 24, "patch": 0 },
"configurePresets": [
{
"name": "default",
"generator": "Visual Studio 16 2019",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "toolchain.cmake"
},
"toolchainFile": "toolchain.cmake"
}
],
"buildPresets": [
{
"name": "release",
"configurePreset": "default",
"configuration": "Release"
}
]
}
This only works because the CMAKE_TOOLCHAIN_FILE
cache variable is being set. After removing this line from the CMakePresets file, the toolchain file is NOT set despite the fact that the toolchainFile
field exists; the field appears to be ignored.