2016-05-27 04:55:05 +08:00
|
|
|
set(LIBFUZZER_FLAGS_BASE "${CMAKE_CXX_FLAGS}")
|
2015-03-31 06:09:51 +08:00
|
|
|
# Disable the coverage and sanitizer instrumentation for the fuzzer itself.
|
2016-05-27 04:55:05 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${LIBFUZZER_FLAGS_BASE} -fno-sanitize=all -fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters -Werror")
|
2015-04-07 00:09:13 +08:00
|
|
|
if( LLVM_USE_SANITIZE_COVERAGE )
|
2015-05-23 06:35:31 +08:00
|
|
|
add_library(LLVMFuzzerNoMainObjects OBJECT
|
2015-01-30 00:58:29 +08:00
|
|
|
FuzzerCrossOver.cpp
|
2015-05-12 05:16:27 +08:00
|
|
|
FuzzerTraceState.cpp
|
2015-02-20 02:45:37 +08:00
|
|
|
FuzzerDriver.cpp
|
2015-01-30 00:58:29 +08:00
|
|
|
FuzzerIO.cpp
|
|
|
|
FuzzerLoop.cpp
|
|
|
|
FuzzerMutate.cpp
|
2015-05-15 06:41:49 +08:00
|
|
|
FuzzerSHA1.cpp
|
2016-02-27 05:33:56 +08:00
|
|
|
FuzzerTracePC.cpp
|
2015-01-30 00:58:29 +08:00
|
|
|
FuzzerUtil.cpp
|
|
|
|
)
|
2015-05-23 06:35:31 +08:00
|
|
|
add_library(LLVMFuzzerNoMain STATIC
|
|
|
|
$<TARGET_OBJECTS:LLVMFuzzerNoMainObjects>
|
|
|
|
)
|
2016-03-01 23:54:40 +08:00
|
|
|
target_link_libraries(LLVMFuzzerNoMain ${PTHREAD_LIB})
|
2015-01-31 07:26:57 +08:00
|
|
|
add_library(LLVMFuzzer STATIC
|
|
|
|
FuzzerMain.cpp
|
2015-05-23 06:35:31 +08:00
|
|
|
$<TARGET_OBJECTS:LLVMFuzzerNoMainObjects>
|
2015-01-31 07:26:57 +08:00
|
|
|
)
|
2016-03-01 23:54:40 +08:00
|
|
|
target_link_libraries(LLVMFuzzer ${PTHREAD_LIB})
|
2015-01-30 00:58:29 +08:00
|
|
|
|
|
|
|
if( LLVM_INCLUDE_TESTS )
|
|
|
|
add_subdirectory(test)
|
|
|
|
endif()
|
|
|
|
endif()
|