# cmake-gui: empty generator or toolset fails on the reconfigure while set inside the toolchain file

**URL:** https://discourse.cmake.org/t/cmake-gui-empty-generator-or-toolset-fails-on-the-reconfigure-while-set-inside-the-toolchain-file/10482
**Category:** Usage
**Created:** [March 26, 2024, 7:08am UTC](https://discourse.cmake.org/t/cmake-gui-empty-generator-or-toolset-fails-on-the-reconfigure-while-set-inside-the-toolchain-file/10482 "2024-03-26T07:08:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![AJIOB](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ajiob/32/852_2.png) [@AJIOB](https://discourse.cmake.org/u/AJIOB)
#### Post date: [March 26, 2024, 7:08am UTC](https://discourse.cmake.org/t/cmake-gui-empty-generator-or-toolset-fails-on-the-reconfigure-while-set-inside-the-toolchain-file/10482/1 "2024-03-26T07:08:29Z")

</div>

# 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.

The problem is a migration from [this issue](https://gitlab.kitware.com/cmake/cmake/-/issues/25822)

# 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

```txt
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`

```txt
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

```txt
Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045.
Configuring done (0.0s)

```

# Steps to reproduce

1. Create empty folder with `CMakeLists.txt` file:

```cmake
cmake_minimum_required(VERSION 3.24)

set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/toolchain.cmake")

project(Test)

```

And `toolchain.cmake` file with contents:

```cmake
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()

```

1. Load project from CMake GUI

2. Delete cache through `File` → `Delete Cache`

3. Press `Configure` button

4. Use this settings (or another from log):  

5. Press `Finish`

6. Wait for configure is finished

7. Press `Configure` button again

8. See the error

---

<div class="post-metadata">

### Author: ![AJIOB](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ajiob/32/852_2.png) [@AJIOB](https://discourse.cmake.org/u/AJIOB)
#### Post date: [April 5, 2024, 11:03am UTC](https://discourse.cmake.org/t/cmake-gui-empty-generator-or-toolset-fails-on-the-reconfigure-while-set-inside-the-toolchain-file/10482/2 "2024-04-05T11:03:22Z")

</div>

I’ve removed the ` CACHE INTERNAL "..."` from all variables inside `toolchain.cmake` and all works as I want
