File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,21 @@ if(WIN32)
3737 include_directories (Win32 )
3838endif ()
3939
40+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang" )
41+ option (LIBSAMPLERATE_ENABLE_SANITIZERS "Enable ASAN and UBSAN" OFF )
42+
43+ if (LIBSAMPLERATE_ENABLE_SANITIZERS)
44+ # Use ASAN and UBSAN, make it fail on any error, improve stack traces
45+ set (sanitizer_flags -fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer)
46+
47+ add_compile_options (${sanitizer_flags} )
48+ string (REPLACE ";" " " sanitizer_flags "${sanitizer_flags} " )
49+ string (APPEND CMAKE_EXE_LINKER_FLAGS " ${sanitizer_flags} " )
50+ string (APPEND CMAKE_MODULE_LINKER_FLAGS " ${sanitizer_flags} " )
51+ string (APPEND CMAKE_SHARED_LINKER_FLAGS " ${sanitizer_flags} " )
52+ endif ()
53+ endif ()
54+
4055test_big_endian(CPU_IS_BIG_ENDIAN)
4156if (CPU_IS_BIG_ENDIAN)
4257 set (CPU_IS_LITTLE_ENDIAN 0)
You can’t perform that action at this time.
0 commit comments