CMakeLists.txt 637 Bytes
Newer Older
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
1 2 3 4 5 6 7
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  message(FATAL_ERROR "You need to build with Clang for fuzzing to work")
endif()

add_library(aec_fuzz STATIC ${libaec_SRCS})
add_executable(fuzz_target fuzz_target.cc)

8
set(FUZZ_TARGET_LINK_FLAGS "-fsanitize=address,undefined")
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
9 10
set(FUZZ_TARGET_COMPILE_FLAGS
  "-g"
11 12
  "-fsanitize=address,undefined"
  "-fno-sanitize-recover=undefined"
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
13 14 15 16 17 18
  "-fsanitize-coverage=trace-pc-guard,indirect-calls,edge")
set_target_properties(fuzz_target aec_fuzz PROPERTIES
  LINK_FLAGS ${FUZZ_TARGET_LINK_FLAGS}
  COMPILE_OPTIONS "${FUZZ_TARGET_COMPILE_FLAGS}")

target_link_libraries(fuzz_target aec_fuzz Fuzzer)