I am generating a visual studio solution using cmake. And now I want to generate pdb files for a Release build. (Why? because I want to have the symbols in case that the user found some bug)
I tried by setting the following flags without succeed:
set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE} CACHE STRING "Build Types" FORCE)
IF(WIN32)
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release")
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "/debug /INCREMENTAL")
set( CMAKE_SHARED_LINKER_FLAGS_RELEASE "/debug /INCREMENTAL")
set( CMAKE_MODULE_LINKER_FLAGS_RELEASE "/debug /INCREMENTAL")
set( CMAKE_CXX_FLAGS_RELEASE "/MD /Zi /O2 /Ob1 /D NDEBUG")
set( CMAKE_C_FLAGS_RELEASE "/MD /Zi /O2 /Ob1 /D NDEBUG")
ENDIF(WIN32)
It looks like Cmake is ignoring these sets: thanks in advance for the help!
add_executable(out a.cpp b.cpp)
and when I built the Release configuration there was also a .pdb file. And it was debuggable. Could you post more details? And btw don't useCMAKE_BUILD_TYPE
when generating for MSVC – Halloo