# Cache variable with type UNINITIALIZED removed by cmake-gui

**URL:** https://discourse.cmake.org/t/cache-variable-with-type-uninitialized-removed-by-cmake-gui/15866
**Category:** Code
**Created:** [October 12, 2026, 10:17pm UTC](https://discourse.cmake.org/t/cache-variable-with-type-uninitialized-removed-by-cmake-gui/15866 "2026-10-12T22:17:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![johan556](https://discourse.cmake.org/user_avatar/discourse.cmake.org/johan556/32/788_2.png) [@johan556](https://discourse.cmake.org/u/johan556)
#### Post date: [October 12, 2026, 10:17pm UTC](https://discourse.cmake.org/t/cache-variable-with-type-uninitialized-removed-by-cmake-gui/15866/1 "2026-10-12T22:17:39Z")

</div>

I had a variable entered in the cache from the command line, without giving it a type. And the variable was not declared as cache variable in my CMakeLists.txt. In the CMakeCache.txt it looked like:

```auto
FOO_UNTYPED:UNINITIALIZED=999

```

I have noticed that this entry in the cache:

- it remains if I run `cmake build_dir`, or `cmake -DNEW_VARIABLE=123 build_dir`
- it remains if I run `ccmake build_dir` add press Configure + Generate
- it disappears if I run `cmake-gui build_dir` and press Configure + Generate

I’m aware that I can avoid this problem by either:

- set the variable as a cache variable with a type in CMakeLists.txt
- supply a type on the command line in the `-D` option

But I was surprised by the way `cmake-gui` differed from the other situations. Is this intentional?

---

<div class="post-metadata">

### Author: ![Aiden.Woodruff](https://discourse.cmake.org/user_avatar/discourse.cmake.org/aiden.woodruff/32/6177_2.png) [@Aiden.Woodruff](https://discourse.cmake.org/u/Aiden.Woodruff)
#### Post date: [October 13, 2026, 1:24pm UTC](https://discourse.cmake.org/t/cache-variable-with-type-uninitialized-removed-by-cmake-gui/15866/2 "2026-10-13T13:24:55Z")

</div>

Johan, I was also able to confirm this with CMake 4.4.4. Definitely seems like oddly divergent behavior to me.

---

<div class="post-metadata">

### Author: ![Aiden.Woodruff](https://discourse.cmake.org/user_avatar/discourse.cmake.org/aiden.woodruff/32/6177_2.png) [@Aiden.Woodruff](https://discourse.cmake.org/u/Aiden.Woodruff)
#### Post date: [October 13, 2026, 1:58pm UTC](https://discourse.cmake.org/t/cache-variable-with-type-uninitialized-removed-by-cmake-gui/15866/3 "2026-10-13T13:58:07Z")

</div>

Looks like this has been reported already in an issue here: [https://gitlab.kitware.com/cmake/cmake/-/work\_items/23721](https://gitlab.kitware.com/cmake/cmake/-/work_items/23721)
