From 0c4c4c651ee0aab0c42d5f11fb7e1d51c6ef4580 Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Wed, 2 Apr 2014 13:07:06 -0700 Subject: CMakeLists: Add _GLIBCXX_DEBUG to enable debug mode for GNU libstdc++ When building in debug mode, define _GLIBCXX_DEBUG and _GLIBCXX_DEBUG_PEDANTIC to enable debug mode in GNU libstdc++. This will throw runtime exceptions to catch incorrect/undefined C++/STL behavior. --- SDL_Core/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SDL_Core/CMakeLists.txt b/SDL_Core/CMakeLists.txt index 3466830fd..befbf48df 100644 --- a/SDL_Core/CMakeLists.txt +++ b/SDL_Core/CMakeLists.txt @@ -101,6 +101,10 @@ add_definitions(-DOS_POSIX) IF(CMAKE_C_FLAGS_DEBUG) SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG" ) add_definitions(-DDEBUG) + + # Enable debug mode in the GNU C++ library, to catch incorrect/undefined behavior + add_definitions(-D_GLIBCXX_DEBUG) + add_definitions(-D_GLIBCXX_DEBUG_PEDANTIC) ELSE (CMAKE_C_FLAGS_DEBUG) SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DRELEASE" ) add_definitions(-DRELEASE) -- cgit v1.2.1