Skip to content

Commit 93b1216

Browse files
committed
Fix Issue #150
1 parent 98b3c68 commit 93b1216

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

cmake/modules/clang.cmake

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,28 @@ if((NOT CMAKE_BUILD_TYPE) OR (CMAKE_BUILD_TYPE STREQUAL "Release"))
3030
set(OPTIMISATION_FLAGS "-O2 -DNDEBUG ${OPTIMISATION_FLAGS}")
3131
endif((NOT CMAKE_BUILD_TYPE) OR (CMAKE_BUILD_TYPE STREQUAL "Release"))
3232

33-
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
34-
add_definitions("-g")
35-
endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
33+
option(enable-glibcxx-debug "use the debug version of the C++ standard as implemented by the glib C++ library" OFF)
34+
if(enable-glibcxx-debug)
35+
if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
36+
set(CMAKE_CXX_FLAGS_DEBUG "-g -D_GLIBCXX_DEBUG -Rno-debug-disables-optimization" CACHE STRING
37+
"Flags used by the C++ compiler during debug builds."
38+
FORCE)
39+
else(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
40+
set(CMAKE_CXX_FLAGS_DEBUG "-g -D_GLIBCXX_DEBUG" CACHE STRING
41+
"Flags used by the C++ compiler during debug builds."
42+
FORCE)
43+
endif(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
44+
else(enable-glibcxx-debug)
45+
if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
46+
set(CMAKE_CXX_FLAGS_DEBUG "-g -Rno-debug-disables-optimization" CACHE STRING
47+
"Flags used by the C++ compiler during debug builds."
48+
FORCE)
49+
else(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
50+
set(CMAKE_CXX_FLAGS_DEBUG "-g" CACHE STRING
51+
"Flags used by the C++ compiler during debug builds."
52+
FORCE)
53+
endif(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
54+
endif(enable-glibcxx-debug)
3655

3756
if(HAVE_FORTRAN)
3857
# we associate clang with the gnu fortran compiler

0 commit comments

Comments
 (0)