Lagom: Make fuzzer cmake less repetitive

This commit is contained in:
Nico Weber 2020-11-19 11:24:39 -05:00 committed by Andreas Kling
parent f5967c4745
commit 3f3a7d128b

View file

@ -1,47 +1,20 @@
add_executable(FuzzBMP FuzzBMP.cpp)
target_compile_options(FuzzBMP
PRIVATE $<$<C_COMPILER_ID:Clang>:-g -O1 -fsanitize=fuzzer>
)
target_link_libraries(FuzzBMP
PUBLIC Lagom
PRIVATE $<$<C_COMPILER_ID:Clang>:-fsanitize=fuzzer>
)
function(add_simple_fuzzer name)
add_executable(${name} "${name}.cpp")
target_compile_options(${name}
PRIVATE $<$<C_COMPILER_ID:Clang>:-g -O1 -fsanitize=fuzzer>
)
target_link_libraries(${name}
PUBLIC Lagom
PRIVATE $<$<C_COMPILER_ID:Clang>:-fsanitize=fuzzer>
)
endfunction()
add_executable(FuzzELF FuzzELF.cpp)
target_compile_options(FuzzELF
PRIVATE $<$<C_COMPILER_ID:Clang>:-g -O1 -fsanitize=fuzzer>
)
target_link_libraries(FuzzELF
PUBLIC Lagom
PRIVATE $<$<C_COMPILER_ID:Clang>:-fsanitize=fuzzer>
)
add_executable(FuzzGemini FuzzGemini.cpp)
target_compile_options(FuzzGemini
PRIVATE $<$<C_COMPILER_ID:Clang>:-g -O1 -fsanitize=fuzzer>
)
target_link_libraries(FuzzGemini
PUBLIC Lagom
PRIVATE $<$<C_COMPILER_ID:Clang>:-fsanitize=fuzzer>
)
add_executable(FuzzPPMLoader FuzzPPMLoader.cpp)
target_compile_options(FuzzPPMLoader
PRIVATE $<$<C_COMPILER_ID:Clang>:-g -O1 -fsanitize=fuzzer>
)
target_link_libraries(FuzzPPMLoader
PUBLIC Lagom
PRIVATE $<$<C_COMPILER_ID:Clang>:-fsanitize=fuzzer>
)
add_executable(FuzzJs FuzzJs.cpp)
target_compile_options(FuzzJs
PRIVATE $<$<C_COMPILER_ID:Clang>:-g -O1 -fsanitize=fuzzer>
)
target_link_libraries(FuzzJs
PUBLIC Lagom
PRIVATE $<$<C_COMPILER_ID:Clang>:-fsanitize=fuzzer>
)
add_simple_fuzzer(FuzzBMP)
add_simple_fuzzer(FuzzELF)
add_simple_fuzzer(FuzzGemini)
add_simple_fuzzer(FuzzPPMLoader)
add_simple_fuzzer(FuzzJs)
add_simple_fuzzer(FuzzMarkdown)
add_executable(FuzzilliJs FuzzilliJs.cpp)
target_compile_options(FuzzilliJs
@ -51,12 +24,3 @@ target_link_libraries(FuzzilliJs
PUBLIC Lagom
PRIVATE $<$<C_COMPILER_ID:Clang>:-fsanitize-coverage=trace-pc-guard>
)
add_executable(FuzzMarkdown FuzzMarkdown.cpp)
target_compile_options(FuzzMarkdown
PRIVATE $<$<C_COMPILER_ID:Clang>:-g -O1 -fsanitize=fuzzer>
)
target_link_libraries(FuzzMarkdown
PUBLIC Lagom
PRIVATE $<$<C_COMPILER_ID:Clang>:-fsanitize=fuzzer>
)