@@ -32,9 +32,28 @@ if((NOT CMAKE_BUILD_TYPE) OR (CMAKE_BUILD_TYPE STREQUAL "Release"))
3232 set (OPTIMISATION_FLAGS "-O2 -DNDEBUG ${OPTIMISATION_FLAGS} " )
3333endif ((NOT CMAKE_BUILD_TYPE ) OR (CMAKE_BUILD_TYPE STREQUAL "Release" ))
3434
35- if (CMAKE_BUILD_TYPE STREQUAL "Debug" )
36- add_definitions ("-g" )
37- endif (CMAKE_BUILD_TYPE STREQUAL "Debug" )
35+ option (enable-glibcxx-debug "use the debug version of the C++ standard as implemented by the glib C++ library" OFF )
36+ if (enable-glibcxx-debug)
37+ if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM" )
38+ set (CMAKE_CXX_FLAGS_DEBUG "-g -D_GLIBCXX_DEBUG -Rno-debug-disables-optimization" CACHE STRING
39+ "Flags used by the C++ compiler during debug builds."
40+ FORCE )
41+ else (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM" )
42+ set (CMAKE_CXX_FLAGS_DEBUG "-g -D_GLIBCXX_DEBUG" CACHE STRING
43+ "Flags used by the C++ compiler during debug builds."
44+ FORCE )
45+ endif (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM" )
46+ else (enable-glibcxx-debug )
47+ if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM" )
48+ set (CMAKE_CXX_FLAGS_DEBUG "-g -Rno-debug-disables-optimization" CACHE STRING
49+ "Flags used by the C++ compiler during debug builds."
50+ FORCE )
51+ else (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM" )
52+ set (CMAKE_CXX_FLAGS_DEBUG "-g" CACHE STRING
53+ "Flags used by the C++ compiler during debug builds."
54+ FORCE )
55+ endif (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM" )
56+ endif (enable-glibcxx-debug )
3857
3958if (HAVE_FORTRAN)
4059 # we associate clang with the gnu fortran compiler
0 commit comments