# Optionally compile with thread sanitizer enabled to find memory bugs
# https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual

# Add optional sanitizer, off by default
option(ADDRESS_SANITIZER "Add address sanitizer" OFF)
if(ADDRESS_SANITIZER)
    add_compile_options(-fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-scope -g)
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
endif()
message("-- Address Sanitizer: ${ADDRESS_SANITIZER}")
