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

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~~~

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.

Thx for your kindly reply.

I find the following code work:

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")