summaryrefslogtreecommitdiff
path: root/fuzzers
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2018-07-19 15:22:18 +0200
committerPatrick Steinhardt <ps@pks.im>2018-08-03 09:50:35 +0200
commitbf3382d5448d4cb0487cc69510b6184d44e7eafc (patch)
tree5c0bd71e72b63396617c51605a3921a7bd6ee36e /fuzzers
parent186a7ba5d71c38e96af07ec9b8dfa29661fabb5a (diff)
downloadlibgit2-bf3382d5448d4cb0487cc69510b6184d44e7eafc.tar.gz
cmake: remove need to add "-fsanitize=fuzzer" flag for fuzzers
Right now, users are being instrucded to add the "-DCMAKE_EXE_LINKER_FLAGS=-fsanitize=fuzzer" flag when they want to build our fuzzers. This is error-prone and user unfriendly. Instead, just add the flag to our fuzzers' build instructions so that it happens automatically. Adjust the README accordingly.
Diffstat (limited to 'fuzzers')
-rw-r--r--fuzzers/CMakeLists.txt4
1 files changed, 4 insertions, 0 deletions
diff --git a/fuzzers/CMakeLists.txt b/fuzzers/CMakeLists.txt
index 13705fa95..ea0612322 100644
--- a/fuzzers/CMakeLists.txt
+++ b/fuzzers/CMakeLists.txt
@@ -1,6 +1,10 @@
LINK_DIRECTORIES(${LIBGIT2_LIBDIRS})
INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDES})
+IF(BUILD_FUZZERS AND NOT USE_STANDALONE_FUZZERS)
+ ADD_C_FLAG(-fsanitize=fuzzer)
+ENDIF ()
+
FILE(GLOB SRC_FUZZ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *_fuzzer.c)
FOREACH(fuzz_target_src ${SRC_FUZZ})
STRING(REPLACE ".c" "" fuzz_target_name ${fuzz_target_src})