Skip to content

Commit 09ed60f

Browse files
trflynn89linusg
authored andcommitted
Add CMake option to enable UBSAN
1 parent 9e841d7 commit 09ed60f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,18 @@ add_compile_options(-Wwrite-strings)
3939
add_compile_options(-fno-exceptions)
4040

4141
option(ENABLE_ADDRESS_SANITIZER "Enable address sanitizer testing in gcc/clang" OFF)
42+
option(ENABLE_UNDEFINED_SANITIZER "Enable undefined behavior sanitizer testing in gcc/clang" OFF)
4243

4344
if (ENABLE_ADDRESS_SANITIZER)
4445
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
4546
add_link_options(-fsanitize=address)
4647
endif()
4748

49+
if (ENABLE_UNDEFINED_SANITIZER)
50+
add_compile_options(-fsanitize=undefined -fno-omit-frame-pointer)
51+
add_link_options(-fsanitize=undefined)
52+
endif()
53+
4854
include (FetchContent)
4955
include (cmake/FetchLagom.cmake)
5056

0 commit comments

Comments
 (0)