# CMAKE\_BUILD\_TYPE, Presets, Multi-config generators

**URL:** https://discourse.cmake.org/t/cmake-build-type-presets-multi-config-generators/9699
**Category:** Usage
**Created:** [December 22, 2023, 8:22pm UTC](https://discourse.cmake.org/t/cmake-build-type-presets-multi-config-generators/9699 "2023-12-22T20:22:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jaquilio](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jaquilio/32/3789_2.png) [@jaquilio](https://discourse.cmake.org/u/jaquilio)
#### Post date: [December 22, 2023, 8:22pm UTC](https://discourse.cmake.org/t/cmake-build-type-presets-multi-config-generators/9699/1 "2023-12-22T20:22:24Z")

</div>

[CMake documentation on Build Configurations](https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#build-configurations) says that " For multi-configuration generators like Visual Studio,…, the configuration is chosen by the user at build time and CMAKE\_BUILD\_TYPE is ignored".

But, then, I see that official blogs and videos from Microsoft giving examples of Visual Studio presets that have lines such as “CMAKE\_BUILD\_TYPE: Debug” under the “cacheVariables” section of the configuration presets.

So, isn’t " CMAKE\_BUILD\_TYPE" really ignored by multi-config IDEs such as Visual Studio contrary to what the above referenced documentation page says?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [December 23, 2023, 10:19pm UTC](https://discourse.cmake.org/t/cmake-build-type-presets-multi-config-generators/9699/2 "2023-12-23T22:19:22Z")

</div>

`CMAKE_BUILD_TYPE` is definitely ignored by multi-config generators. But projects are often (wrongly) written assuming a single config generator is used, and they might always (try to) set or use `CMAKE_BUILD_TYPE` even when it isn’t appropriate. Some IDEs also make the same mistake. For example, CLion only recently stopped setting `CMAKE_BUILD_TYPE` when using a multi-config generator.

Note that you can use a single config generator with the Visual Studio toolchain. The blogs, videos and examples you’re looking at may be in that category. But if they are setting `CMAKE_BUILD_TYPE` and using the Visual Studio generator rather than a generator like Ninja, that’s wrong.

---

<div class="post-metadata">

### Author: ![jaquilio](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jaquilio/32/3789_2.png) [@jaquilio](https://discourse.cmake.org/u/jaquilio)
#### Post date: [December 23, 2023, 10:39pm UTC](https://discourse.cmake.org/t/cmake-build-type-presets-multi-config-generators/9699/3 "2023-12-23T22:39:20Z")

</div>

Thanks!  
One example I had seen and followed was [this one](https://www.youtube.com/watch?v=-NhaPNq16Qk) with an example being shown at the 10:50 time point. I had considered it a trustworthy example since it was provided by the product manager associated with adding the presets feature to Visual Studio :).
