diff --git a/nc.cmake b/nc.cmake index 196aa46..6b90ff8 100644 --- a/nc.cmake +++ b/nc.cmake @@ -14,6 +14,7 @@ find_package (Threads REQUIRED) link_libraries (Threads::Threads) include (nc_cxx) +include (nc_sanitizer) include (nc_platform) include (nc_optimisation) include (nc_warnings) diff --git a/nc_sanitizer.cmake b/nc_sanitizer.cmake new file mode 100644 index 0000000..d33b8fc --- /dev/null +++ b/nc_sanitizer.cmake @@ -0,0 +1,14 @@ +option (SANITIZER "enable sanitizers" OFF) + +if (SANITIZER) + append_compile_flag("-fsanitize=undefined") + append_compile_flag("-fsanitize=address") + append_compile_flag("-fsanitize=leak") + + append_compile_flag("--param max-gcse-memory=167772160") + + append_compile_flag("-fsanitize=pointer-compare") + append_compile_flag("-fsanitize=pointer-subtract") + + add_definitions("-D_GLIBCXX_SANITIZE_VECTOR") +endif() \ No newline at end of file