if(HAVE_ASAN)
add_compile_definitions(HAVE_ASAN)
add_compile_options(-fsanitize=address)
+ if(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
+ endif()
link_libraries(asan)
check_flag(-fsanitize-recover=address IGNORE)
endif()
if(HAVE_UBSAN)
add_compile_definitions(HAVE_UBSAN)
add_compile_options(-fsanitize=undefined)
+ if(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
+ endif()
link_libraries(ubsan)
check_flag(-fsanitize-recover=undefined IGNORE)
endif()