mirror of
https://github.com/alexbatalov/fallout1-ce.git
synced 2024-11-20 08:10:40 +00:00
CMake: Add ASAN and UBSAN (#116)
This commit is contained in:
parent
c138d7fb9d
commit
f33143d0db
@ -20,12 +20,24 @@ set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||
set(CMAKE_CXX_EXTENSIONS NO)
|
||||
|
||||
option(ASAN "Enable address sanitizer" OFF)
|
||||
option(UBSAN "Enable undefined behaviour sanitizer" OFF)
|
||||
|
||||
if (ANDROID)
|
||||
add_library(${EXECUTABLE_NAME} SHARED)
|
||||
else()
|
||||
add_executable(${EXECUTABLE_NAME} WIN32 MACOSX_BUNDLE)
|
||||
endif()
|
||||
|
||||
if(ASAN)
|
||||
target_compile_options(${EXECUTABLE_NAME} PUBLIC "-fsanitize=address;-fsanitize-recover=address")
|
||||
target_link_options(${EXECUTABLE_NAME} PUBLIC "-fsanitize=address;-fsanitize-recover=address")
|
||||
endif()
|
||||
if(UBSAN)
|
||||
target_compile_options(${EXECUTABLE_NAME} PUBLIC "-fsanitize=undefined")
|
||||
target_link_options(${EXECUTABLE_NAME} PUBLIC "-fsanitize=undefined")
|
||||
endif()
|
||||
|
||||
target_include_directories(${EXECUTABLE_NAME} PUBLIC src)
|
||||
|
||||
target_sources(${EXECUTABLE_NAME} PUBLIC
|
||||
|
Loading…
Reference in New Issue
Block a user