diff --git a/CMakeLists.txt b/CMakeLists.txt index e5e559714..758ae3332 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,7 +194,7 @@ include( CMakeColors ) set( CMAKE_CXX_STANDARD 17 ) set( CMAKE_CXX_STANDARD_REQUIRED ON ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=return-type" ) -set( CMAKE_CXX_FLAGS_DEBUG "-g ${CMAKE_CXX_FLAGS_DEBUG}" ) +set( CMAKE_CXX_FLAGS_DEBUG "-Og -g ${CMAKE_CXX_FLAGS_DEBUG}" ) set( CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG" ) set( CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" ) set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" ) @@ -202,7 +202,7 @@ set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" ) set( CMAKE_C_STANDARD 99 ) set( CMAKE_C_STANDARD_REQUIRED ON ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall" ) -set( CMAKE_C_FLAGS_DEBUG "-g" ) +set( CMAKE_C_FLAGS_DEBUG "-Og -g" ) set( CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" ) set( CMAKE_C_FLAGS_RELEASE "-O4 -DNDEBUG" ) set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" ) @@ -230,6 +230,10 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) string( APPEND CMAKE_CXX_FLAGS " ${CLANG_WARNINGS}" ) endforeach() + # The dwarf-debugging flags are slightly different, too + string( APPEND CMAKE_CXX_FLAGS_DEBUG " -gdwarf" ) + string( APPEND CMAKE_C_FLAGS_DEBUG " -gdwarf" ) + # Third-party code where we don't care so much about compiler warnings # (because it's uncomfortable to patch) get different flags; use # mark_thirdparty_code( [...] )