From ed1abbccdf1b349da112af241735c0de482a9aa4 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Tue, 24 Nov 2015 14:17:23 +0100 Subject: [PATCH] Use dwarf-2 debug symbol format on non msvc windows builds to support file and line numbers display on wine backtraces. Having file and line numbers display makes it more easy to find runtime error with cross compiled windows builds. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721 --- cmake/CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 4bde279..6d99f1a 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -204,7 +204,6 @@ if(DBUS_WITH_GLIB) autodefine(GLIB_VERSION_MAX_ALLOWED) endif() -SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG") if(MSVC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /w14018") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w14018") @@ -213,6 +212,18 @@ else() SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-compare") endif() +# +# set compiler debug flags +# +set(DEBUG_CFLAGS "-D_DEBUG") +if(WIN32 AND NOT MSVC) + set(DEBUG_CFLAGS "${DEBUG_CFLAGS} -gdwarf-2") +endif() +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_CFLAGS}") +set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${DEBUG_CFLAGS}") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_CFLAGS}") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${DEBUG_CFLAGS}") + ######################################################################### # Windows CE (>= 5.0.0) # -- 1.8.4.5