# CMAKE\_BUILD\_TYPE doc question

**URL:** <https://discourse.cmake.org/t/cmake-build-type-doc-question/3990>\
**Category:** Code\
**Created:** [August 27, 2021, 3:18pm UTC](https://discourse.cmake.org/t/cmake-build-type-doc-question/3990 "2021-08-27T15:18:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shivupa](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/bb73d2/32.png) [@shivupa](https://discourse.cmake.org/u/shivupa)\
**Post date:** [August 27, 2021, 3:18pm UTC](https://discourse.cmake.org/t/cmake-build-type-doc-question/3990/1 "2021-08-27T15:18:16Z")

</div>

> Note that configuration names are case-insensitive. The value of this variable will be the same as it is specified when invoking CMake. For instance, if `-DCMAKE_BUILD_TYPE=ReLeAsE` is specified, then the value of `CMAKE_BUILD_TYPE` will be `ReLeAsE`.

This wording of this portion of the documentation is confusing to me. This seems to imply that `CMAKE_BUILD_TYPE` is case sensitive not case insensitive.

source: [https://cmake.org/cmake/help/git-stage/variable/CMAKE\_BUILD\_TYPE.html](https://cmake.org/cmake/help/git-stage/variable/CMAKE_BUILD_TYPE.html)

---

<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:** [August 28, 2021, 12:31am UTC](https://discourse.cmake.org/t/cmake-build-type-doc-question/3990/2 "2021-08-28T00:31:22Z")

</div>

It is case-insensitive in just about everywhere it gets used (since “all” code does `to_upper` on the name before using it). It is case-preserving however and will keep the case provided.

---

<div class="post-metadata">

**Author:** ![hsattler](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/h/59ef9b/32.png) [@hsattler](https://discourse.cmake.org/u/hsattler)\
**Post date:** [August 28, 2021, 5:48am UTC](https://discourse.cmake.org/t/cmake-build-type-doc-question/3990/3 "2021-08-28T05:48:13Z")

</div>

Really? Also properties and variable names?

The problem is probably not in functions using the build type string but rather in conditionals in scripts trying to match Debug vs. not Debug. However, the needed regexp is just slightly more complicated.

---

<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:** [August 28, 2021, 2:19pm UTC](https://discourse.cmake.org/t/cmake-build-type-doc-question/3990/4 "2021-08-28T14:19:05Z")

</div>

No, properties and variable names are _always_ case sensitive. It’s just that with build types, “everyone” does `string(TOUPPER)` on it before using it. This is historical behavior that I wish wouldn’t have been done, but there’s not much to be done about it today.

---

<div class="post-metadata">

**Author:** ![hex](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hex/32/363_2.png) [@hex](https://discourse.cmake.org/u/hex)\
**Post date:** [August 28, 2021, 5:10pm UTC](https://discourse.cmake.org/t/cmake-build-type-doc-question/3990/5 "2021-08-28T17:10:50Z")

</div>

but then, `CMAKE_BUILD_TYPE` _is_ case sensitive, it is just that some existing CMake projects are treating it as case insensitive.

So, the latest documentation implies that it is best practice to treat `CMAKE_BUILD_TYPE` as case insensitive, is this correct? In other words, should any new code behave like historical behaviour?

---

<div class="post-metadata">

**Author:** ![shivupa](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/bb73d2/32.png) [@shivupa](https://discourse.cmake.org/u/shivupa)\
**Post date:** [August 28, 2021, 5:59pm UTC](https://discourse.cmake.org/t/cmake-build-type-doc-question/3990/6 "2021-08-28T17:59:04Z")

</div>

I agree. In my own projects I am indeed using TOUPPER, but to me it seems that the documentation implies what hex is saying. Any new user might come along and try to use it without TOUPPER.

---

<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:** [August 28, 2021, 8:35pm UTC](https://discourse.cmake.org/t/cmake-build-type-doc-question/3990/7 "2021-08-28T20:35:42Z")

</div>

Please feel free to improve the docs (or file an issue to do so). There’s a lot of history in CMake and explaining these things in the right place helps everyone 🙂 .
