# How to specify a dll as debug and other dll as release?

**URL:** https://discourse.cmake.org/t/how-to-specify-a-dll-as-debug-and-other-dll-as-release/9215
**Category:** Usage
**Created:** [October 18, 2023, 5:42am UTC](https://discourse.cmake.org/t/how-to-specify-a-dll-as-debug-and-other-dll-as-release/9215 "2023-10-18T05:42:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.cmake.org/user_avatar/discourse.cmake.org/zhang-qiang-github/32/1913_2.png) [@zhang-qiang-github](https://discourse.cmake.org/u/zhang-qiang-github)
#### Post date: [October 18, 2023, 5:42am UTC](https://discourse.cmake.org/t/how-to-specify-a-dll-as-debug-and-other-dll-as-release/9215/1 "2023-10-18T05:42:05Z")

</div>

In vs, I have 10 dll projects. Generally, I run it in release. Sometime, I need to debug one dll. So, I will manually change the dll from release to debug by:

1. property → c/c++ → general → debugging information → /Zi
2. property → c/c++ → optimize → optimize → /Od
3. property → link → debug → generate debug information → /DEBUG

However, when I start vs from cmake, the manually setting would be removed.

I wonder if it is possible to set the dll as debug from cmake? So that after start vs from cmake, I can run vs in release, and debug into one specific dll?

Any suggestion is appreciated~~~

---

<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: [October 18, 2023, 2:02pm UTC](https://discourse.cmake.org/t/how-to-specify-a-dll-as-debug-and-other-dll-as-release/9215/2 "2023-10-18T14:02:04Z")

</div>

I think you might want `RelWithDebInfo` here. CMake does not mix configs in a single build, so debugging a single DLL isn’t something I think well supported.

---

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.cmake.org/user_avatar/discourse.cmake.org/zhang-qiang-github/32/1913_2.png) [@zhang-qiang-github](https://discourse.cmake.org/u/zhang-qiang-github)
#### Post date: [October 19, 2023, 7:56am UTC](https://discourse.cmake.org/t/how-to-specify-a-dll-as-debug-and-other-dll-as-release/9215/3 "2023-10-19T07:56:31Z")

</div>

Thx for your kindly reply.

I find the following code work:

```auto
set(CMAKE_CXX_FLAGS_RELEASE "/Zi /Od /Ob0 /DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "/Zi /Od /Ob0 /DNDEBUG")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/debug /INCREMENTAL")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "/debug /INCREMENTAL")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/debug /INCREMENTAL")

```
