xref: /freebsd/contrib/libpcap/testprogs/fuzz/CMakeLists.txt (revision 6f9cba8f8b5efd16249633e52483ea351876b67b)
1add_executable(fuzz_pcap onefile.c fuzz_pcap.c)
2target_link_libraries(fuzz_pcap ${ARGN} ${LIBRARY_NAME}_static ${PCAP_LINK_LIBRARIES})
3if(NOT "${SANITIZER_FLAGS}" STREQUAL "")
4  set_target_properties(fuzz_pcap PROPERTIES
5      LINK_FLAGS "${SANITIZER_FLAGS}")
6endif()
7
8add_executable(fuzz_filter onefile.c fuzz_filter.c)
9target_link_libraries(fuzz_filter ${ARGN} ${LIBRARY_NAME}_static ${PCAP_LINK_LIBRARIES})
10if(NOT "${SANITIZER_FLAGS}" STREQUAL "")
11  set_target_properties(fuzz_filter PROPERTIES
12      LINK_FLAGS "${SANITIZER_FLAGS}")
13endif()
14
15add_executable(fuzz_both onefile.c fuzz_both.c)
16target_link_libraries(fuzz_both ${ARGN} ${LIBRARY_NAME}_static ${PCAP_LINK_LIBRARIES})
17if(NOT "${SANITIZER_FLAGS}" STREQUAL "")
18  set_target_properties(fuzz_both PROPERTIES
19      LINK_FLAGS "${SANITIZER_FLAGS}")
20endif()
21
22if(ENABLE_REMOTE AND "$ENV{CFLAGS}" MATCHES "-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION")
23add_executable(fuzz_rclient onefile.c fuzz_rclient.c)
24target_link_libraries(fuzz_rclient ${ARGN} ${LIBRARY_NAME}_static ${PCAP_LINK_LIBRARIES})
25if(NOT "${SANITIZER_FLAGS}" STREQUAL "")
26  set_target_properties(fuzz_rclient PROPERTIES
27      LINK_FLAGS "${SANITIZER_FLAGS}")
28endif()
29
30add_executable(fuzz_rserver onefile.c fuzz_rserver.c ../../rpcapd/daemon.c)
31check_function_exists(crypt HAVE_CRYPT_IN_SYSTEM_LIBRARIES)
32if(HAVE_CRYPT_IN_SYSTEM_LIBRARIES)
33    set(HAVE_CRYPT TRUE)
34else(HAVE_CRYPT_IN_SYSTEM_LIBRARIES)
35     set(PCAP_LINK_LIBRARIES ${PCAP_LINK_LIBRARIES} crypt)
36endif(HAVE_CRYPT_IN_SYSTEM_LIBRARIES)
37target_link_libraries(fuzz_rserver ${ARGN} ${LIBRARY_NAME}_static ${PCAP_LINK_LIBRARIES})
38
39if(NOT "${SANITIZER_FLAGS}" STREQUAL "")
40  set_target_properties(fuzz_rserver PROPERTIES
41      LINK_FLAGS "${SANITIZER_FLAGS}")
42endif()
43endif(ENABLE_REMOTE AND "$ENV{CFLAGS}" MATCHES "-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION")
44