diff --git a/CMakeLists.txt b/CMakeLists.txt index a3431b61..e0d77706 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,7 @@ endif() option(ISLE_BUILD_APP "Build isle application" ON) option(ISLE_ASAN "Enable Address Sanitizer" OFF) +option(ISLE_UBSAN "Enable Undefined Behavior Sanitizer" OFF) option(ISLE_WERROR "Treat warnings as errors" OFF) cmake_dependent_option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" "${NOT_MINGW}" "WIN32;CMAKE_SIZEOF_VOID_P EQUAL 4" OFF) cmake_dependent_option(ISLE_MINIWIN "Use miniwin and minimfc" ON "NOT ISLE_USE_DX5" OFF) @@ -74,6 +75,11 @@ if (ISLE_ASAN) add_link_options(-fsanitize=address) endif() +if (ISLE_UBSAN) + add_compile_options(-fsanitize=undefined -fno-sanitize-recover=undefined) + add_link_options(-fsanitize=undefined) +endif() + #if (NOT WIN32) add_library(miniwin STATIC EXCLUDE_FROM_ALL miniwin/miniwin/src/miniwin.cpp