2021-08-02 12:29:25 +00:00
|
|
|
#compile with warnings
|
2021-08-02 13:46:49 +00:00
|
|
|
if(WIN32)
|
2021-09-02 08:37:03 +00:00
|
|
|
add_compile_options(/W4 /WX "$<$<CONFIG:DEBUG>:/MTd>")
|
2021-08-02 12:29:25 +00:00
|
|
|
else()
|
|
|
|
add_compile_options(-Wall -Wextra -pedantic -Werror)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
#enable asan in debug
|
2021-08-02 13:46:49 +00:00
|
|
|
if(WIN32)
|
2021-08-02 12:29:25 +00:00
|
|
|
add_compile_options("$<$<CONFIG:DEBUG>:-fsanitize=address>")
|
|
|
|
else()
|
|
|
|
add_compile_options("$<$<CONFIG:DEBUG>:-fsanitize=address>")
|
|
|
|
add_link_options("$<$<CONFIG:DEBUG>:-fsanitize=address>")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
#enable ubsan in debug
|
2021-08-02 13:46:49 +00:00
|
|
|
if(NOT WIN32)
|
2021-08-02 12:29:25 +00:00
|
|
|
add_compile_options("$<$<CONFIG:DEBUG>:-fsanitize=undefined>"
|
|
|
|
"$<$<CONFIG:DEBUG>:-fno-omit-frame-pointer>")
|
|
|
|
add_link_options("$<$<CONFIG:DEBUG>:-fsanitize=undefined>")
|
|
|
|
endif()
|