summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt8
1 files changed, 6 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 261d071..c5db14b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,7 +10,7 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_STANDARD 11)
#set warning as error
-add_compile_options(-Wall -Wextra -Werror -Wno-error=unused-variable -Wno-error=unused-parameter)
+add_compile_options(-Wall -Wextra -Werror)
if(NOT CMAKE_BUILD_TYPE)
@@ -57,7 +57,7 @@ endif()
#ASAN option
set(ASAN_OPTION "OFF" CACHE STRING
" set asan type chosen by the user, using OFF as default")
-set_property(CACHE ASAN_OPTION PROPERTY STRINGS OFF ADDRESS THREAD)
+set_property(CACHE ASAN_OPTION PROPERTY STRINGS OFF ADDRESS THREAD UBSAN)
message(STATUS "ASAN_OPTION='${ASAN_OPTION}'")
if(ASAN_OPTION STREQUAL "ADDRESS")
@@ -72,6 +72,10 @@ elseif(ASAN_OPTION STREQUAL "THREAD")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")
add_definitions(-DASAN_ENABLED=1)
+elseif(ASAN_OPTION STREQUAL "UBSAN")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=undefined -fno-sanitize-recover=all")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=undefined -fno-sanitize-recover=all")
+
endif()
include_directories(${CMAKE_SOURCE_DIR})