cmake: make sanitizers linking #468

This commit is contained in:
anzz1 2023-03-25 21:39:05 +02:00 committed by GitHub
parent 2d27013343
commit 779c37f916
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,14 +76,17 @@ find_package(Threads REQUIRED)
if (NOT MSVC)
if (LLAMA_SANITIZE_THREAD)
add_compile_options(-fsanitize=thread)
link_libraries(-fsanitize=thread)
endif()
if (LLAMA_SANITIZE_ADDRESS)
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
link_libraries(-fsanitize=address)
endif()
if (LLAMA_SANITIZE_UNDEFINED)
add_compile_options(-fsanitize=undefined)
link_libraries(-fsanitize=undefined)
endif()
endif()