# \[BUG\] CMake uses extra hidden flags

**URL:** https://discourse.cmake.org/t/bug-cmake-uses-extra-hidden-flags/12983
**Category:** Development
**Tags:** os:windows, comp:msvc, gen:vs
**Created:** [November 18, 2024, 11:21am UTC](https://discourse.cmake.org/t/bug-cmake-uses-extra-hidden-flags/12983 "2024-11-18T11:21:31Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Paradox84](https://discourse.cmake.org/user_avatar/discourse.cmake.org/paradox84/32/5131_2.png) [@Paradox84](https://discourse.cmake.org/u/Paradox84)
#### Post date: [November 18, 2024, 11:21am UTC](https://discourse.cmake.org/t/bug-cmake-uses-extra-hidden-flags/12983/1 "2024-11-18T11:21:31Z")

</div>

In Debug configuration CMake uses \Zi flag, but when you try to create a custom configuration which is just a clone of Debug, that config won’t have \Zi flag

In my opinion this is a bug and CMake only should use flags which is included in “CMAKE\_CXX\_FLAGS\_DEBUG”

Example code

```CMake
set(CMAKE_CONFIGURATION_TYPES "Debug;DebugEditor" CACHE STRING "Available build configurations" FORCE)

set(CMAKE_CXX_FLAGS_DEBUGEDITOR "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "CXX Flags for DebugEditor configuration" FORCE)
set(CMAKE_C_FLAGS_DEBUGEDITOR "${CMAKE_C_FLAGS_DEBUG}" CACHE STRING "C Flags for DebugEditor configuration" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_DEBUGEDITOR "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING "Linker Flags for DebugEditor configuration" FORCE)

```

Am I misusing something or is this really a bug?

---

<div class="post-metadata">

### Author: ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)
#### Post date: [November 18, 2024, 12:24pm UTC](https://discourse.cmake.org/t/bug-cmake-uses-extra-hidden-flags/12983/2 "2024-11-18T12:24:07Z")

</div>

Maybe the [DEBUG\_CONFIGURATIONS](https://cmake.org/cmake/help/latest/prop_gbl/DEBUG_CONFIGURATIONS.html) global property can help you…

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [November 18, 2024, 1:32pm UTC](https://discourse.cmake.org/t/bug-cmake-uses-extra-hidden-flags/12983/3 "2024-11-18T13:32:52Z")

</div>

The `/Zi` flag is for MSVC debug information. See the [`CMAKE_MSVC_DEBUG_INFORMATION_FORMAT`](https://cmake.org/cmake/help/v3.31/variable/CMAKE_MSVC_DEBUG_INFORMATION_FORMAT.html) variable and corresponding [`MSVC_DEBUG_INFORMATION_FORMAT`](https://cmake.org/cmake/help/v3.31/prop_tgt/MSVC_DEBUG_INFORMATION_FORMAT.html) target property.

`DEBUG_CONFIGURATIONS` is only about the `target_link_libraries` command.

---

<div class="post-metadata">

### Author: ![Paradox84](https://discourse.cmake.org/user_avatar/discourse.cmake.org/paradox84/32/5131_2.png) [@Paradox84](https://discourse.cmake.org/u/Paradox84)
#### Post date: [November 18, 2024, 1:49pm UTC](https://discourse.cmake.org/t/bug-cmake-uses-extra-hidden-flags/12983/4 "2024-11-18T13:49:22Z")

</div>

Thanks, that was it. Are there any other things that I should be aware of when using custom configurations?

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [November 18, 2024, 2:07pm UTC](https://discourse.cmake.org/t/bug-cmake-uses-extra-hidden-flags/12983/5 "2024-11-18T14:07:34Z")

</div>

See also [`CMAKE_MSVC_RUNTIME_LIBRARY`](https://cmake.org/cmake/help/v3.31/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html).

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [November 18, 2024, 2:07pm UTC](https://discourse.cmake.org/t/bug-cmake-uses-extra-hidden-flags/12983/6 "2024-11-18T14:07:41Z")

</div>

Currently we have no official documentation on how to create custom configurations. I’ve opened [CMake Issue 26454](https://gitlab.kitware.com/cmake/cmake/-/issues/26454) for that.

---

<div class="post-metadata">

### Author: ![Paradox84](https://discourse.cmake.org/user_avatar/discourse.cmake.org/paradox84/32/5131_2.png) [@Paradox84](https://discourse.cmake.org/u/Paradox84)
#### Post date: [November 18, 2024, 2:18pm UTC](https://discourse.cmake.org/t/bug-cmake-uses-extra-hidden-flags/12983/7 "2024-11-18T14:18:55Z")

</div>

I’m aware of _CMAKE\_MSVC\_RUNTIME\_LIBRARY_  
I was wondering since solution to original problem was an MSVC specific thing, could other compilers require something similar? (for same problem or maybe for their unique problems)  
But since you didn’t mention them, I’m just gonna assume there aren’t any, unless anyone says otherwise.

Thanks for all the help, and documenting this sounds great!
