llvm.org GIT mirror llvm / 33a7788
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 Justin Bogner 2 years ago
7 changed file(s) with 52 addition(s) and 70 deletion(s). Raw diff Collapse all Expand all
891891 endif()
892892 endmacro(add_llvm_utility name)
893893
894 macro(add_llvm_fuzzer name)
895 if( LLVM_USE_SANITIZE_COVERAGE )
896 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
897 add_llvm_executable(${name} ${ARGN})
898 set_target_properties(${name} PROPERTIES FOLDER "Fuzzers")
899 endif()
900 endmacro()
894901
895902 macro(add_llvm_target target_name)
896903 include_directories(BEFORE
None if( LLVM_USE_SANITIZE_COVERAGE )
1
2 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
3 set(LLVM_LINK_COMPONENTS
4 AsmParser
5 BitWriter
6 Core
7 Support
8 )
9 add_llvm_tool(llvm-as-fuzzer
10 llvm-as-fuzzer.cpp)
11 endif()
0 set(LLVM_LINK_COMPONENTS
1 AsmParser
2 BitWriter
3 Core
4 Support
5 )
6 add_llvm_fuzzer(llvm-as-fuzzer llvm-as-fuzzer.cpp)
1010 llvm-dwarfdump.cpp
1111 )
1212
13 if(LLVM_USE_SANITIZE_COVERAGE)
14 add_subdirectory(fuzzer)
15 endif()
13 add_subdirectory(fuzzer)
33 Support
44 )
55
6 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
7
8 add_llvm_executable(llvm-dwarfdump-fuzzer
6 add_llvm_fuzzer(llvm-dwarfdump-fuzzer
97 EXCLUDE_FROM_ALL
108 llvm-dwarfdump-fuzzer.cpp
119 )
None if( LLVM_USE_SANITIZE_COVERAGE )
1
2 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
3 set(LLVM_LINK_COMPONENTS
4 ${LLVM_TARGETS_TO_BUILD}
5 Analysis
6 AsmPrinter
7 CodeGen
8 Core
9 FuzzMutate
10 IRReader
11 MC
12 ScalarOpts
13 SelectionDAG
14 Support
15 Target
16 )
17 add_llvm_tool(llvm-isel-fuzzer
18 llvm-isel-fuzzer.cpp)
19 endif()
0 set(LLVM_LINK_COMPONENTS
1 ${LLVM_TARGETS_TO_BUILD}
2 Analysis
3 AsmPrinter
4 CodeGen
5 Core
6 FuzzMutate
7 IRReader
8 MC
9 ScalarOpts
10 SelectionDAG
11 Support
12 Target
13 )
14 add_llvm_fuzzer(llvm-isel-fuzzer llvm-isel-fuzzer.cpp)
None if( LLVM_USE_SANITIZE_COVERAGE )
1 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
2
3 set(LLVM_LINK_COMPONENTS
4 AllTargetsAsmPrinters
5 AllTargetsAsmParsers
6 AllTargetsDescs
7 AllTargetsInfos
8 MC
9 MCParser
10 Support
11 )
12
13 add_llvm_tool(llvm-mc-assemble-fuzzer
14 llvm-mc-assemble-fuzzer.cpp)
15 endif()
0 set(LLVM_LINK_COMPONENTS
1 AllTargetsAsmPrinters
2 AllTargetsAsmParsers
3 AllTargetsDescs
4 AllTargetsInfos
5 MC
6 MCParser
7 Support
8 )
9 add_llvm_fuzzer(llvm-mc-assemble-fuzzer llvm-mc-assemble-fuzzer.cpp)
None if( LLVM_USE_SANITIZE_COVERAGE )
1
2 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
3 set(LLVM_LINK_COMPONENTS
4 AllTargetsAsmPrinters
5 AllTargetsDescs
6 AllTargetsDisassemblers
7 AllTargetsInfos
8 MC
9 MCDisassembler
10 MCParser
11 Support
12 )
13 add_llvm_tool(llvm-mc-disassemble-fuzzer
14 llvm-mc-disassemble-fuzzer.cpp)
15 endif()
0 set(LLVM_LINK_COMPONENTS
1 AllTargetsAsmPrinters
2 AllTargetsDescs
3 AllTargetsDisassemblers
4 AllTargetsInfos
5 MC
6 MCDisassembler
7 MCParser
8 Support
9 )
10 add_llvm_fuzzer(llvm-mc-disassemble-fuzzer llvm-mc-disassemble-fuzzer.cpp)