From e7719b6e0b0401855788f686d6577f51c56d6db1 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Fri, 15 Mar 2024 17:04:49 -0700 Subject: [PATCH] Disable sanitizers when cross-compiling --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a5371f8..845f786 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,9 +154,11 @@ if(BUILD_TESTING) file(GLOB CORPUS_TESTS ${CMAKE_SOURCE_DIR}/corpus/*) add_executable(fuzz_driver ConflictSet.cpp FuzzTestDriver.cpp) - target_compile_options(fuzz_driver PRIVATE ${TEST_FLAGS} - -fsanitize=address,undefined) - target_link_options(fuzz_driver PRIVATE -fsanitize=address,undefined) + target_compile_options(fuzz_driver PRIVATE ${TEST_FLAGS}) + if(NOT CMAKE_CROSSCOMPILING) + target_compile_options(fuzz_driver PRIVATE -fsanitize=address,undefined) + target_link_options(fuzz_driver PRIVATE -fsanitize=address,undefined) + endif() target_compile_definitions(fuzz_driver PRIVATE ENABLE_FUZZ) target_include_directories(fuzz_driver PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)