Is there any way to create only symbol table using cmake for gdb ?
Add this line to the file CMakeLists.txt:
set(CMAKE_BUILD_TYPE Debug)
The usual way to produce debugging information for gdb
is to pass -g
to the gcc
or g++
compiler (and also at linking time).
Look into the Cmake FAQ for how to get a debuggable executable.
compile in Release mode optimized but adding debug symbols, useful for profiling :
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ...
or compile with NO optimization and adding debug symbols :
cmake -DCMAKE_BUILD_TYPE=Debug ...