diff --git a/CMakeLists.txt b/CMakeLists.txt index a9f81e6..690038f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,10 @@ check_c_compiler_flag(-fstack-protector-strong HAS_STACK_PROTCTOR_STRONG) if(HAS_STACK_PROTCTOR_STRONG) set(CMAKE_C_FLAGS "-fstack-protector-strong ${CMAKE_C_FLAGS}") endif() +check_c_compiler_flag(-fsanitize=undefined HAS_SANITIZE_UNDEFINED) +if(HAS_SANITIZE_UNDEFINED) + set(CMAKE_C_FLAGS "-fsanitize=undefined ${CMAKE_C_FLAGS}") +endif() set(CMAKE_C_FLAGS "-std=gnu11 -Wall ${CMAKE_C_FLAGS}") add_definitions(-D_GNU_SOURCE)