aboutsummaryrefslogtreecommitdiff
path: root/tests/fuzz/CMakeLists.txt
blob: 5982e81c6299fd96dd576b5870fcaeae97d0afb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
project(fuzzing CXX)

macro(fuzzer name)
    add_executable(${name} ${name}.cpp)
    target_link_libraries(${name}
                          PRIVATE
                              ssh::static)
    if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
        set_target_properties(${name}
                              PROPERTIES
                                  COMPILE_FLAGS "-fsanitize=fuzzer"
                                  LINK_FLAGS "-fsanitize=fuzzer")
        # Run the fuzzer to make sure it works
        add_test(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name} -runs=1)
    else()
        target_sources(${name} PRIVATE fuzzer.c)
        # Run the fuzzer to make sure it works
        # add_test(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name} EXAMPLE)
    endif()
endmacro()

fuzzer(ssh_client_fuzzer)
fuzzer(ssh_server_fuzzer)