Remove "-O2 -g" from default CMAKE_C_FLAGS. - Those are the RelWithDebInfo flags. - They should be controlled from CMAKE_BUILD_TYPE