xref: /freebsd/contrib/libpcap/testprogs/CMakeLists.txt (revision 2e3f49888ec8851bafb22011533217487764fdb0)
1if(MSVC)
2  file(GLOB PROJECT_SOURCE_LIST_WIN32_C ${pcap_SOURCE_DIR}/missing/getopt.c)
3  include_directories(${pcap_SOURCE_DIR}/missing)
4endif(MSVC)
5
6add_custom_target(testprogs)
7
8macro(add_test_executable _executable)
9  add_executable(${_executable} EXCLUDE_FROM_ALL
10    ${_executable}.c ${PROJECT_SOURCE_LIST_WIN32_C})
11  if(NOT C_ADDITIONAL_FLAGS STREQUAL "")
12    set_target_properties(${_executable} PROPERTIES
13      COMPILE_FLAGS ${C_ADDITIONAL_FLAGS})
14  endif()
15  if(WIN32)
16    target_link_libraries(${_executable}
17      ${ARGN} ${LIBRARY_NAME} ${PCAP_LINK_LIBRARIES})
18  else(WIN32)
19    target_link_libraries(${_executable}
20      ${ARGN} ${LIBRARY_NAME}_static ${PCAP_LINK_LIBRARIES})
21  endif(WIN32)
22  if(NOT "${LINKER_FLAGS}" STREQUAL "")
23    set_target_properties(${_executable} PROPERTIES
24      LINK_FLAGS "${LINKER_FLAGS}")
25  endif()
26  add_dependencies(testprogs ${_executable})
27endmacro()
28
29add_test_executable(can_set_rfmon_test)
30add_test_executable(capturetest)
31add_test_executable(filtertest)
32add_test_executable(findalldevstest)
33add_test_executable(findalldevstest-perf)
34add_test_executable(opentest)
35add_test_executable(reactivatetest)
36add_test_executable(writecaptest)
37
38if(NOT WIN32)
39  add_test_executable(selpolltest)
40endif()
41
42add_test_executable(threadsignaltest ${CMAKE_THREAD_LIBS_INIT})
43
44# Same as in configure.ac.
45if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
46   CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR
47   CMAKE_SYSTEM_NAME STREQUAL "Linux")
48  add_test_executable(valgrindtest)
49endif()
50
51add_subdirectory(fuzz)
52