diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b73b4cdd..7fe85be23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,7 @@ option(ENABLE_COVERAGE "Enable coverage reporting for gcc/clang" OFF) option(ENABLE_MATPLOTLIB "Enable matplotlib library in experiments" OFF) option(ENABLE_NAUTY "Enable the Nauty library for percy" OFF) option(ENABLE_ABC "Enable linking ABC as a static library" OFF) +option(ENABLE_ASAN, "Enable ASAN sanitizer" OFF) if(UNIX) # show quite some warnings (but remove some intentionally) @@ -28,6 +29,10 @@ if(UNIX) if (ENABLE_COVERAGE) add_compile_options(-O0 -g --coverage -fprofile-arcs -ftest-coverage) endif() + if (ENABLE_ASAN) + add_compile_options(-fsanitize=address -fno-omit-frame-pointer) + add_link_options(-fsanitize=address) + endif() endif() if(MSVC) add_compile_options(/EHsc /bigobj)