1set(LIBFUZZER_FLAGS_BASE "${CMAKE_CXX_FLAGS_RELEASE}")
2# Disable the coverage and sanitizer instrumentation for the fuzzer itself.
3set(CMAKE_CXX_FLAGS_RELEASE "${LIBFUZZER_FLAGS_BASE} -O2 -fno-sanitize=all")
4if( LLVM_USE_SANITIZE_COVERAGE )
5  add_library(LLVMFuzzerNoMain OBJECT
6    FuzzerCrossOver.cpp
7    FuzzerDFSan.cpp
8    FuzzerDriver.cpp
9    FuzzerIO.cpp
10    FuzzerLoop.cpp
11    FuzzerMutate.cpp
12    FuzzerSanitizerOptions.cpp
13    FuzzerUtil.cpp
14    )
15  add_library(LLVMFuzzer STATIC
16    FuzzerMain.cpp
17    $<TARGET_OBJECTS:LLVMFuzzerNoMain>
18    )
19
20  if( LLVM_INCLUDE_TESTS )
21    add_subdirectory(test)
22  endif()
23endif()
24