Support Address Sanitizer

This commit is contained in:
Deukhoofd 2022-03-22 18:35:00 +01:00
parent aba538d351
commit 91596d8ab4
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 5 additions and 0 deletions

View File

@ -11,6 +11,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
option(WINDOWS "Whether the build target is Windows or not." OFF)
option(SHARED "Whether we should build a shared library, instead of a static one." ON)
option(PKMNLIB_TESTS "Whether the test executable should be build as well." OFF)
option(SANITIZER_TESTS "Whether the test executable should be built using address sanitizer." ON)
option(STATICC "Whether gcc and stdc++ should be linked statically to the library." OFF)
option(ANGELSCRIPT_DEBUGGER "Include the angelscript debug server in the build." OFF)
set(SCRIPT_PROVIDER "angelscript" CACHE STRING "Which script provider to use.")
@ -226,6 +227,10 @@ if (PKMNLIB_TESTS)
# Add a definition for the test library
target_compile_definitions(pkmnLibTests PRIVATE TESTS_BUILD)
if (SANITIZER_TESTS AND NOT WINDOWS)
target_compile_options(pkmnLibTests PRIVATE -fsanitize=address)
target_link_options(pkmnLibTests PRIVATE -fsanitize=address)
endif()
endif ()
if (ANGELSCRIPT_DEBUGGER)