Support Address Sanitizer
This commit is contained in:
parent
aba538d351
commit
91596d8ab4
|
@ -11,6 +11,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
option(WINDOWS "Whether the build target is Windows or not." OFF)
|
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(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(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(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)
|
option(ANGELSCRIPT_DEBUGGER "Include the angelscript debug server in the build." OFF)
|
||||||
set(SCRIPT_PROVIDER "angelscript" CACHE STRING "Which script provider to use.")
|
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
|
# Add a definition for the test library
|
||||||
target_compile_definitions(pkmnLibTests PRIVATE TESTS_BUILD)
|
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 ()
|
endif ()
|
||||||
|
|
||||||
if (ANGELSCRIPT_DEBUGGER)
|
if (ANGELSCRIPT_DEBUGGER)
|
||||||
|
|
Loading…
Reference in New Issue