summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2017-08-31 00:36:33 +0000
committerJustin Bogner <mail@justinbogner.com>2017-08-31 00:36:33 +0000
commit33a778823ba743242b7332a8608ec084e4319d3f (patch)
tree8844f6f95a88bd426ab7b27188f14d9bce32f01d /cmake
parentcb4a5a0eb41d0a2e3273bdf699ec598f86b4c740 (diff)
cmake: Invent add_llvm_fuzzer to set up fuzzer targets
This moves the cmake configuration for fuzzers in LLVM to a new macro, add_llvm_fuzzer. This will make it easier to keep things consistent while implementing llvm.org/pr34314. I've also made a couple of minor functional changes here: - the fuzzers now use add_llvm_executable rather than add_llvm_tool. This means they won't create install targets and stuff like that, because those made little sense for these fuzzers. - I've grouped these under "Fuzzers" rather than in with "Tools" for people who build with IDEs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312200 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/AddLLVM.cmake7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index 1c922651b13..8c884db4706 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -892,6 +892,13 @@ macro(add_llvm_utility name)
endif()
endmacro(add_llvm_utility name)
+macro(add_llvm_fuzzer name)
+ if( LLVM_USE_SANITIZE_COVERAGE )
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
+ add_llvm_executable(${name} ${ARGN})
+ set_target_properties(${name} PROPERTIES FOLDER "Fuzzers")
+ endif()
+endmacro()
macro(add_llvm_target target_name)
include_directories(BEFORE