cmake-gui: empty generator or toolset fails on the reconfigure while set inside the script
Description
I need to load default valued inside the main CMakeLists.txt
script.
If you keep generator
& toolset
values from CMake GUI empty, they really pass empty values.
If I correctly understand the #24864 (closed), this should work after upgrading to 3.29.0, but it really doesn't work.
Environment
CMake GUI 3.29.0 Windows 10 Pro Visual Studio 17 2022 generator
Error text from GUI log
- Nothing was specified in generator & toolset
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.
- generator was set as
x64
CMake Error: Error: generator toolset:
Does not match the toolset used previously: v143
Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.
- both generator & toolset specified
Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045.
Configuring done (0.0s)
Steps to reproduce
- Create empty folder with
CMakeLists.txt
file:
cmake_minimum_required(VERSION 3.24)
if(NOT CMAKE_GENERATOR_TOOLSET)
set(CMAKE_GENERATOR_TOOLSET "v143" CACHE INTERNAL "Visual Studio toolset to use for CMake")
endif()
if(NOT CMAKE_GENERATOR_PLATFORM)
set(CMAKE_GENERATOR_PLATFORM "x64" CACHE INTERNAL "Visual Studio platform to use for CMake")
endif()
if(NOT CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE)
set(CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE "x64" CACHE INTERNAL "Host architecture to use for CMake")
endif()
project(Test)