CMake: add option for enabling sanitizers
This commit is contained in:
@@ -13,11 +13,15 @@ if(APPLE)
|
||||
enable_language(OBJC)
|
||||
endif()
|
||||
|
||||
set(SANITIZERS FALSE)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
if(${CMAKE_BUILD_TYPE} MATCHES Release OR ${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo)
|
||||
if(NOT SANITIZERS)
|
||||
message("LTO ON")
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
src/frontend/Settings
|
||||
@@ -147,7 +151,7 @@ endif()
|
||||
target_link_libraries(kaizen PUBLIC imgui SDL3::SDL3 SDL3::SDL3-static cflags::cflags ${MIO_LIB} parallel-rdp capstone backend)
|
||||
target_compile_definitions(kaizen PUBLIC SDL_MAIN_HANDLED)
|
||||
|
||||
if (${CMAKE_BUILD_TYPE} MATCHES Debug)
|
||||
if (SANITIZERS)
|
||||
target_compile_options(kaizen PUBLIC -fsanitize=undefined -fsanitize=address)
|
||||
target_link_options(kaizen PUBLIC -fsanitize=undefined -fsanitize=address)
|
||||
endif ()
|
||||
|
||||
Reference in New Issue
Block a user