Your approach with adding set(CMAKE_BUILD_TYPE Debug) works fine.
But g2o is a program that was built with Release options. Debug g2o version of g2o is called g2o_d . Thus, for debugging you need to run the debugger as follows:
user2@arm _machine:~/g2o/trunk/bin$ gdb g2o_d
Note
Different names are not a common feature of CMake , but only a g2o project :
# postfix, based on type SET(CMAKE_DEBUG_POSTFIX "_d" CACHE STRING "postfix applied to debug build of libraries") SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "postfix applied to release build of libraries")
source share