xref: /openbsd-src/gnu/llvm/lldb/tools/lldb-fuzzer/lldb-commandinterpreter-fuzzer/CMakeLists.txt (revision f6aab3d83b51b91c24247ad2c2573574de475a82)
1set(LLVM_LINK_COMPONENTS
2  Support
3  )
4
5add_llvm_fuzzer(lldb-commandinterpreter-fuzzer
6  EXCLUDE_FROM_ALL
7  lldb-commandinterpreter-fuzzer.cpp
8  )
9
10if(TARGET lldb-commandinterpreter-fuzzer)
11  target_include_directories(lldb-commandinterpreter-fuzzer PRIVATE ..)
12  target_link_libraries(lldb-commandinterpreter-fuzzer
13    PRIVATE
14    liblldb
15    )
16
17  # A directory in the build directory is created to hold the fuzzer's
18  # artifacts as a pre-build command for the command interpreter's executable
19  # target. When the fuzzer exits the input artifact that caused it to exit
20  # will be written to this directory.
21
22  add_custom_command(TARGET lldb-commandinterpreter-fuzzer PRE_BUILD
23    COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/fuzzer-artifacts/commandinterpreter-artifacts
24    )
25
26  add_custom_target(fuzz-lldb-commandinterpreter
27    COMMENT "Running the LLDB command interpreter fuzzer..."
28    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/fuzzer-artifacts/commandinterpreter-artifacts
29    COMMAND  $<TARGET_FILE:lldb-commandinterpreter-fuzzer> -dict=${CMAKE_CURRENT_SOURCE_DIR}/inputdictionary.txt  -only_ascii=1 -artifact_prefix=commandinterpreter-
30    USES_TERMINAL
31    )
32endif()
33