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