xref: /freebsd/contrib/libpcap/testprogs/CMakeLists.txt (revision 924226fba12cc9a228c73b956e1b7fa24c60b055)
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  add_dependencies(testprogs ${_executable})
23endmacro()
24
25add_test_executable(can_set_rfmon_test)
26add_test_executable(capturetest)
27add_test_executable(filtertest)
28add_test_executable(findalldevstest)
29add_test_executable(opentest)
30add_test_executable(reactivatetest)
31
32if(NOT WIN32)
33  add_test_executable(selpolltest)
34endif()
35
36add_test_executable(threadsignaltest ${CMAKE_THREAD_LIBS_INIT})
37
38if(NOT WIN32)
39  add_test_executable(valgrindtest)
40endif()
41