Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to generate pdb files for Release build with cmake flags?

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!

like image 354
Eze Velez Avatar asked Jan 27 '15 20:01

Eze Velez


People also ask

What is PDB path?

PDB Path in CodeView Debug Information In both cases, the name of the PDB file with the . pdb extension is included to ensure the debugger locates the correct PDB for the program. A partially qualified PDB path would list only the PDB file name, such as: Test.pdb.

What is RelwithDebInfo?

exerpt: "RelwithDebInfo is quite similar to Release mode. It produces fully optimized code, but also builds the program database, and inserts debug line information to give a debugger a good chance at guessing where in the code you are at any time."


1 Answers

I used the flags

set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")

This site explains the details

like image 172
PhilLab Avatar answered Sep 19 '22 14:09

PhilLab