[PATCH] D38858: [cmake] Allow building fuzzers with OSS-Fuzz flags.
Matt Morehouse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 12 13:53:17 PDT 2017
morehouse updated this revision to Diff 118839.
morehouse added a comment.
- Add cache variable and rename to LLVM_LIB_FUZZING_ENGINE.
https://reviews.llvm.org/D38858
Files:
llvm/CMakeLists.txt
llvm/cmake/modules/AddLLVM.cmake
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -894,15 +894,20 @@
macro(add_llvm_fuzzer name)
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(LLVM_OPTIONAL_SOURCES ${ARG_DUMMY_MAIN})
add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
set_target_properties(${name} PROPERTIES FOLDER "Fuzzers")
elseif( ARG_DUMMY_MAIN )
add_llvm_executable(${name} ${ARG_DUMMY_MAIN} ${ARG_UNPARSED_ARGUMENTS})
set_target_properties(${name} PROPERTIES FOLDER "Fuzzers")
-endif()
+ endif()
endmacro()
macro(add_llvm_target target_name)
Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -435,6 +435,8 @@
set(LLVM_USE_SANITIZER "" CACHE STRING
"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
"Use -gsplit-dwarf when compiling llvm." OFF)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38858.118839.patch
Type: text/x-patch
Size: 1566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171012/988392da/attachment.bin>
More information about the llvm-commits
mailing list