Debian Codegraph @

3rdparty/catch2/fuzzing/CMakeLists.txt

raw
1 # License: Boost 1.0
2 # By Paul Dreik 2020
3
4 # add a library that brings in the main() function from libfuzzer
5 # and has all the dependencies, so the individual fuzzers can be
6 # added one line each.
7 add_library(fuzzhelper NullOStream.h NullOStream.cpp)
8 target_link_libraries(fuzzhelper PUBLIC Catch2::Catch2)
9
10 # use C++17 so we can get string_view
11 target_compile_features(fuzzhelper PUBLIC cxx_std_17)
12
13 # This should be possible to set from the outside to be oss-fuzz compatible,
14 # fix later. For now, target libFuzzer only.
15 target_link_options(fuzzhelper PUBLIC "-fsanitize=fuzzer")
16
17 foreach(fuzzer TestSpecParser XmlWriter textflow)
18 add_executable(fuzz_${fuzzer} fuzz_${fuzzer}.cpp)
19 target_link_libraries(fuzz_${fuzzer} PRIVATE fuzzhelper)
20 endforeach()