1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 05:17:34 +00:00

CMake: Allow building fuzzing targets without libFuzzer or OSS-Fuzz

This commit is contained in:
Tim Schumacher 2022-03-21 11:36:41 +01:00 committed by Brian Gianforcaro
parent e3519b8e5c
commit bf502ae3b0
4 changed files with 20 additions and 9 deletions

View file

@ -4,7 +4,7 @@ function(add_simple_fuzzer name)
if (ENABLE_FUZZERS_OSSFUZZ)
target_link_libraries(${name}
PUBLIC ${ARGN} LagomCore)
else()
elseif (ENABLE_FUZZERS_LIBFUZZER)
target_compile_options(${name}
PRIVATE $<$<CXX_COMPILER_ID:Clang>:-g -O1 -fsanitize=fuzzer>
)
@ -63,7 +63,7 @@ add_simple_fuzzer(FuzzWasmParser LagomWasm)
add_simple_fuzzer(FuzzZip LagomArchive)
add_simple_fuzzer(FuzzZlibDecompression LagomCompress)
if (NOT ENABLE_FUZZERS_OSSFUZZ)
if (ENABLE_FUZZERS_LIBFUZZER)
set(CMAKE_EXE_LINKER_FLAGS "${ORIGINAL_CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_SHARED_LINKER_FLAGS "${ORIGINAL_CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_MODULE_LINKER_FLAGS "${ORIGINAL_CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")