# mark\_as\_advanced strange behaviour

**URL:** https://discourse.cmake.org/t/mark-as-advanced-strange-behaviour/15461
**Category:** Development
**Tags:** os:linux, gen:ninja
**Created:** [January 16, 2026, 11:39am UTC](https://discourse.cmake.org/t/mark-as-advanced-strange-behaviour/15461 "2026-01-16T11:39:22Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Tharrik](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tharrik/32/5980_2.png) [@Tharrik](https://discourse.cmake.org/u/Tharrik)
#### Post date: [January 16, 2026, 11:39am UTC](https://discourse.cmake.org/t/mark-as-advanced-strange-behaviour/15461/1 "2026-01-16T11:39:22Z")

</div>

I’m currently learning in-deep CMake and I found something I don’t understand.

I have this script:

```auto
cmake_minimum_required(VERSION 4.2)

project(CmakeLearn VERSION 1.0 LANGUAGES CXX)

# check that CMAKE_BUILD_TYPE is defined
set(BUILD_TYPES "Debug" "Release" "RelWithDebInfo" "MinSizeRel")
if(NOT (CMAKE_BUILD_TYPE IN_LIST BUILD_TYPES))
	message(FATAL_ERROR "CMAKE_BUILD_TYPE is not defined! Please set it to Debug, Release, RelWithDebInfo, or MinSizeRel.")
endif()

set(SOURCE_FILES
    "src/main.cpp"
)

add_executable(MyApp ${SOURCE_FILES})
target_include_directories(MyApp PRIVATE ./include)

set(CACHE{MYAPP_ADVANCED_CVAR}
	TYPE STRING
	HELP "This cache variable is hidden"
	VALUE "I'm hidding")

#mark_as_advanced(MYAPP_ADVANCED_CVAR)

```

If I execute it in the GUI I see these non-advanced variables:

- CMAKE\_BUILD\_TYPE
- CMAKE\_INSTALL\_PREFIX
- MYAPP\_ADVANCED\_CVAR

If I uncomment the last line to mark MYAPP\_ADVANCED\_CVAR as advanced it changes to this:

- CMAKE\_INSTALL\_PREFIX

I don’t understand why the CMAKE\_BUILD\_TYPE disappears from the non-advanced list of variables.

Also, shouldn’t CMAKE\_INSTALL\_PREFIX be an advanced variable?

I’m using CMake 4.2.1 in Ubuntu 20.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 9, 2026, 2:20am UTC](https://discourse.cmake.org/t/mark-as-advanced-strange-behaviour/15461/2 "2026-02-09T02:20:54Z")

</div>

I needed to initialize `CMAKE_BUILD_TYPE` because it is the empty string by default on Linux. But I’m not seeing it disappear from the non-advanced view after uncommenting the variable and reconfiguring.

`CMAKE_INSTALL_PREFIX` is not an “advanced” thing as “anyone” installing a project will want to see/set it.
