@@ -22,10 +22,48 @@ cet_set_compiler_flags(DIAGS VIGILANT
2222 EXTRA_FLAGS -pedantic -Wno-unused-parameter
2323 )
2424
25- #string(TOUPPER ${CMAKE_BUILD_TYPE} BTYPE_UC )
26- #if( ${BTYPE_UC} MATCHES "DEBUG" )
27- # cet_add_compiler_flags(-fsanitize=address)
28- #endif()
25+
26+ string (TOUPPER ${CMAKE_BUILD_TYPE} BTYPE_UC)
27+ if (BTYPE_UC STREQUAL DEBUG)
28+ add_definitions (-DDEBUGME )
29+ if (DEFINED ENV{USE_ASAN})
30+ if ($ENV{USE_ASAN} GREATER 0)
31+ message ("!!! Address Sanitizer Activated!!!" )
32+ message ("!!! Note: To run, add 'export ASAN_OPTIONS=verify_asan_link_order=0' to setup !!!" )
33+ add_compile_options (-fsanitize=address -Wno-unused-command-line-argument )
34+ add_link_options (-lasan )
35+ endif ()
36+ endif ()
37+ if (DEFINED ENV{USE_TSAN})
38+ if ($ENV{USE_TSAN} GREATER 0)
39+ message ("!!! Thread Sanitizer Activated!!!" )
40+ add_compile_options (-fsanitize=thread -Wno-unused-command-line-argument -Wno-tsan )
41+ add_link_options (-ltsan )
42+ endif ()
43+ endif ()
44+ if (DEFINED ENV{USE_UBSAN})
45+ if ($ENV{USE_UBSAN} GREATER 0)
46+ message ("!!! \" Undefined Behavior\" Sanitizer Activated!!!" )
47+ add_compile_options (-fsanitize=undefined -Wno-unused-command-line-argument )
48+ add_link_options (-lubsan )
49+ endif ()
50+ endif ()
51+ if (DEFINED ENV{USE_GCOV})
52+ add_compile_options (-fprofile-arcs -ftest-coverage --coverage )
53+ add_link_options (--coverage )
54+ endif ()
55+ endif ()
56+
57+ #exeption stack trace
58+ if (DEFINED ENV{USE_EXCEPTIONSTACKTRACE})
59+ if ($ENV{USE_EXCEPTIONSTACKTRACE} GREATER 0)
60+ message ("!!! Exception StackTrace Activated!!!" )
61+ add_definitions (-D EXCEPTIONSTACKTRACE )
62+ set ( EXCEPTIONSTACKTRACE_LIB artdaq-core_Utilities_ExceptionStackTrace )
63+ add_compile_options ( -rdynamic -Wno-unused-command-line-argument )
64+ add_link_options ( -rdynamic )
65+ endif ()
66+ endif ()
2967
3068#cet_report_compiler_flags()
3169
0 commit comments