aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorLexi Winter <lexi@le-fay.org>2025-07-01 21:12:11 +0100
committerLexi Winter <lexi@le-fay.org>2025-07-01 21:12:11 +0100
commit85baf16dd366fb501dc522a0957ec680dc9478f0 (patch)
tree64b9a9463c6b886e9784b1fce9ff5c80dc7e0a23 /CMakeLists.txt
parente461c17c24115132601362a96b6a85c0dd12f471 (diff)
downloadnihil-85baf16dd366fb501dc522a0957ec680dc9478f0.tar.gz
nihil-85baf16dd366fb501dc522a0957ec680dc9478f0.tar.bz2
cli: clean up
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 32a8f81..c51c2aa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,6 +8,8 @@ option(NIHIL_CONFIG "Build the nihil.config library" ON)
option(NIHIL_UCL "Build the nihil.ucl library" ON)
option(NIHIL_TESTS "Build nihil's unit tests" ON)
option(NIHIL_TIDY "Run clang-tidy during build" ON)
+option(NIHIL_ASAN "Enable Address Sanitizer" OFF)
+option(NIHIL_UBSAN "Enable Undefined Behaviour Sanitizer" OFF)
set(CMAKE_CXX_STANDARD 26)
@@ -41,6 +43,16 @@ add_compile_options(-Wextra)
add_compile_options(-Werror)
add_compile_options(-Wpedantic)
+if(NIHIL_ASAN)
+ add_compile_options(-fsanitize=address)
+ add_link_options(-fsanitize=address)
+endif()
+
+if(NIHIL_UBSAN)
+ add_compile_options(-fsanitize=undefined)
+ add_link_options(-fsanitize=undefined)
+endif()
+
# Enable libc++ hardening
add_compile_definitions(-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE)