From 4eb33d7964f93560b92ad98218e57f8a7cd55dbc Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Tue, 22 Mar 2022 12:28:42 +0100 Subject: [PATCH] Add support for AddressSanitizer to unit tests --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c263580..6922e85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,6 +119,9 @@ if (ARBUTILS_TESTS) target_link_libraries(ArbutilsTests Arbutils ${LINKS}) # Add a compilation definition to the code that we are building a test build. target_compile_definitions(ArbutilsTests PRIVATE TESTS_BUILD) + + target_compile_options(ArbutilsTests PRIVATE -fsanitize=address) + target_link_options(ArbutilsTests PRIVATE -fsanitize=address) endif ()