SetupThreadSanitizer.cmake 405 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
# Optionally compile with thread sanitizer enabled to find concurrency bugs
# https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual

# Add optional sanitizer, off by default
option(THREAD_SANITIZER "Add thread sanitizer" OFF)
if(THREAD_SANITIZER)
    add_compile_options(-fsanitize=thread -g)
    add_link_options(-fsanitize=thread)
endif()
message("-- Thread Sanitizer: ${THREAD_SANITIZER}")