mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[cmake] Allow building fuzzers with OSS-Fuzz flags.
Reviewers: kcc, bogner Reviewed By: bogner Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D38858 llvm-svn: 315629
This commit is contained in:
parent
a196f15138
commit
9d74587a92
@ -435,6 +435,8 @@ endif( LLVM_USE_OPROFILE )
|
|||||||
|
|
||||||
set(LLVM_USE_SANITIZER "" CACHE STRING
|
set(LLVM_USE_SANITIZER "" CACHE STRING
|
||||||
"Define the sanitizer used to build binaries and tests.")
|
"Define the sanitizer used to build binaries and tests.")
|
||||||
|
set(LLVM_LIB_FUZZING_ENGINE "" CACHE PATH
|
||||||
|
"Path to fuzzing library for linking with fuzz targets")
|
||||||
|
|
||||||
option(LLVM_USE_SPLIT_DWARF
|
option(LLVM_USE_SPLIT_DWARF
|
||||||
"Use -gsplit-dwarf when compiling llvm." OFF)
|
"Use -gsplit-dwarf when compiling llvm." OFF)
|
||||||
|
@ -894,7 +894,12 @@ endmacro(add_llvm_utility name)
|
|||||||
|
|
||||||
macro(add_llvm_fuzzer name)
|
macro(add_llvm_fuzzer name)
|
||||||
cmake_parse_arguments(ARG "" "DUMMY_MAIN" "" ${ARGN})
|
cmake_parse_arguments(ARG "" "DUMMY_MAIN" "" ${ARGN})
|
||||||
if( LLVM_USE_SANITIZE_COVERAGE )
|
if( LLVM_LIB_FUZZING_ENGINE )
|
||||||
|
set(LLVM_OPTIONAL_SOURCES ${ARG_DUMMY_MAIN})
|
||||||
|
add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
|
||||||
|
target_link_libraries(${name} ${LLVM_LIB_FUZZING_ENGINE})
|
||||||
|
set_target_properties(${name} PROPERTIES FOLDER "Fuzzers")
|
||||||
|
elseif( LLVM_USE_SANITIZE_COVERAGE )
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
|
||||||
set(LLVM_OPTIONAL_SOURCES ${ARG_DUMMY_MAIN})
|
set(LLVM_OPTIONAL_SOURCES ${ARG_DUMMY_MAIN})
|
||||||
add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
|
add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
|
||||||
@ -902,7 +907,7 @@ macro(add_llvm_fuzzer name)
|
|||||||
elseif( ARG_DUMMY_MAIN )
|
elseif( ARG_DUMMY_MAIN )
|
||||||
add_llvm_executable(${name} ${ARG_DUMMY_MAIN} ${ARG_UNPARSED_ARGUMENTS})
|
add_llvm_executable(${name} ${ARG_DUMMY_MAIN} ${ARG_UNPARSED_ARGUMENTS})
|
||||||
set_target_properties(${name} PROPERTIES FOLDER "Fuzzers")
|
set_target_properties(${name} PROPERTIES FOLDER "Fuzzers")
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(add_llvm_target target_name)
|
macro(add_llvm_target target_name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user