CMakeLists.txt 753 B

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