enable sanitizer depending on build flags
This commit is contained in:
parent
17f292aced
commit
6b9d5f570c
@ -4,6 +4,8 @@ project(nf7 C CXX)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
option(SANITIZER "ADDRESS or THREAD" "THREAD")
|
||||
|
||||
# all targets should link to this to use common compile options
|
||||
add_library(nf7_config INTERFACE EXCLUDE_FROM_ALL)
|
||||
target_compile_options(nf7_config INTERFACE
|
||||
@ -14,6 +16,14 @@ target_compile_options(nf7_config INTERFACE
|
||||
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:
|
||||
-Wall -Wextra -Wpedantic
|
||||
$<$<CONFIG:Debug>:-Werror>
|
||||
$<$<STREQUAL:${SANITIZER},ADDRESS>:-fsanitize=address,leak,undefined>
|
||||
$<$<STREQUAL:${SANITIZER},THREAD>:-fsanitize=thread,undefined>
|
||||
>
|
||||
)
|
||||
target_link_options(nf7_config INTERFACE
|
||||
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:
|
||||
$<$<STREQUAL:${SANITIZER},ADDRESS>:-fsanitize=address,leak,undefined>
|
||||
$<$<STREQUAL:${SANITIZER},THREAD>:-fsanitize=thread,undefined>
|
||||
>
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user