summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2017-09-01 17:02:22 +0000
committerJustin Bogner <mail@justinbogner.com>2017-09-01 17:02:22 +0000
commit8cb6b3ebf8480fe273085b39396b852fa9302041 (patch)
treef70ff1393464ddadfd57feb6800068ef78135a71 /cmake
parent96b6414540fe7cdbb410ba0bce5e475a8f06f224 (diff)
llvm-isel-fuzzer: Make buildable and testable without libFuzzer
This adds a dummy main so we can build and run the llvm-isel-fuzzer functionality when we aren't building LLVM with coverage. The approach here should serve as a template to stop in-tree fuzzers from bitrotting (See llvm.org/pr34314). Note that I'll probably move most of the logic in DummyISelFuzzer's `main` to a library so it's easy to reuse it in other fuzz targets, but I'm planning on doing that in a follow up that also consolidates argument handling in our LLVMFuzzerInitialize implementations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312338 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/AddLLVM.cmake8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index 8c884db4706..61417865c77 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -893,11 +893,15 @@ macro(add_llvm_utility name)
endmacro(add_llvm_utility name)
macro(add_llvm_fuzzer name)
+ cmake_parse_arguments(ARG "" "DUMMY_MAIN" "" ${ARGN})
if( LLVM_USE_SANITIZE_COVERAGE )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
- add_llvm_executable(${name} ${ARGN})
+ add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
set_target_properties(${name} PROPERTIES FOLDER "Fuzzers")
- endif()
+ elseif( ARG_DUMMY_MAIN )
+ add_llvm_executable(${name} ${ARG_DUMMY_MAIN} ${ARG_UNPARSED_ARGUMENTS})
+ set_target_properties(${name} PROPERTIES FOLDER "Fuzzers")
+endif()
endmacro()
macro(add_llvm_target target_name)