xref: /src/contrib/libpcap/testprogs/CMakeLists.txt (revision 16cef5f7a65588def71db4fdfa961f959847e3b6)
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(versiontest)
37add_test_executable(writecaptest)
38
39if(NOT WIN32)
40  add_test_executable(selpolltest)
41endif()
42
43add_test_executable(threadsignaltest ${CMAKE_THREAD_LIBS_INIT})
44
45# Same as in configure.ac.
46if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
47   CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR
48   CMAKE_SYSTEM_NAME STREQUAL "Linux")
49  add_test_executable(valgrindtest)
50endif()
51
52if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
53   CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR
54   CMAKE_SYSTEM_NAME STREQUAL "Linux")
55  if(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git)
56     add_subdirectory(fuzz)
57  endif(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git)
58endif()
59