uaudp: removed old/unused code (#if 0...#endif)
[metze/wireshark/wip.git] / CMakeLists.txt
index 1210946f7b122be6428e1815d5d42a4c5b175570..99ff435818f76771cadd0eaf02022534749b16d9 100644 (file)
@@ -1152,9 +1152,6 @@ else()
        # non-empty value, be sure to clear it when not found.
        set(LIBXML2_LIBRARIES "")
 endif()
-if(EXTCAP_ANDROIDDUMP_LIBPCAP)
-       set(ANDROIDDUMP_USE_LIBPCAP 1)
-endif()
 
 if (HAVE_LIBWINSPARKLE)
        set(HAVE_SOFTWARE_UPDATE 1)
@@ -1250,12 +1247,24 @@ set_target_properties(checkAPI
 
 include( UseCheckAPI )
 
+# Target platform locations
+# UN*X in general, including macOS if not building an app bundle:
+# $DESTDIR/lib/wireshark/extcap
+# Windows: $DESTDIR/extcap
+# macOS app bundle: Wireshark.app/Contents/Resources/share/wireshark/extcap
+if (WIN32)
+       set(EXTCAP_DIR "extcap" CACHE INTERNAL "The extcap dir")
+else ()
+       set(EXTCAP_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/${CPACK_PACKAGE_NAME}/extcap" CACHE INTERNAL "The extcap dir")
+endif()
+
 add_subdirectory( capchild )
 add_subdirectory( caputils )
 add_subdirectory( codecs )
 add_subdirectory( doc )
 add_subdirectory( docbook EXCLUDE_FROM_ALL )
 add_subdirectory( epan )
+add_subdirectory( extcap )
 add_subdirectory( randpkt_core )
 add_subdirectory( tools/lemon )
 add_subdirectory( ui )
@@ -1290,25 +1299,6 @@ if(BUILD_wireshark AND QT_FOUND)
        add_subdirectory( ui/qt )
 endif()
 
-# Target platform locations
-# UN*X in general, including macOS if not building an app bundle:
-# $DESTDIR/lib/wireshark/extcap
-# Windows: $DESTDIR/extcap
-# macOS app bundle: Wireshark.app/Contents/Resources/share/wireshark/extcap
-if (WIN32)
-       set(EXTCAP_DIR "extcap")
-else ()
-       set(EXTCAP_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/${CPACK_PACKAGE_NAME}/extcap")
-endif()
-
-if(LIBSSH_FOUND)
-       SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LIBSSH_LIBRARIES})
-       CHECK_FUNCTION_EXISTS(ssh_userauth_agent LIBSSH_USERAUTH_AGENT_FOUND)
-       if(LIBSSH_USERAUTH_AGENT_FOUND)
-               set(HAVE_SSH_USERAUTH_AGENT 1)
-       endif()
-endif()
-
 # Directory where plugins and Lua dissectors can be found.
 set(PLUGIN_VERSION_DIR "plugins/${PROJECT_RELEASE_VERSION}")
 set(PLUGIN_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/${PLUGIN_VERSION_DIR}")
@@ -1379,15 +1369,11 @@ endif()
 include(gmxTestLargeFiles)
 gmx_test_large_files(GMX_LARGEFILES)
 
-if (GIT_EXECUTABLE)
-       set(GIT_BIN_PARAM --git-bin ${GIT_EXECUTABLE})
-endif()
 set( VERSION ${PROJECT_VERSION} )
 add_custom_target(version
        BYPRODUCTS version.h
        COMMAND ${PERL_EXECUTABLE}
                ${CMAKE_SOURCE_DIR}/make-version.pl
-               --set-vcs ${GIT_BIN_PARAM}
                ${CMAKE_SOURCE_DIR}
 )
 set_target_properties(version PROPERTIES FOLDER "Auxiliary")
@@ -1400,6 +1386,7 @@ set( exec_prefix "\${prefix}" )
 set( libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}" )
 set( includedir  "\${prefix}/include" )
 set( plugindir "\${libdir}/wireshark/${PLUGIN_VERSION_DIR}" )
+set( VERSION_RELEASE "${PROJECT_RELEASE_VERSION}" )
 
 # Doxygen variables
 file(GLOB TOP_LEVEL_SOURCE_LIST *.c *.cpp *.h)
@@ -1858,13 +1845,6 @@ foreach(_install_file ${INSTALL_FILES})
        list(APPEND copy_data_files_depends "${_output_file}")
 endforeach()
 
-# Ensure "run/extcap" exists
-add_custom_command(OUTPUT "${DATAFILE_DIR}/extcap"
-       COMMAND ${CMAKE_COMMAND} -E make_directory
-               "${DATAFILE_DIR}/extcap"
-)
-list(APPEND copy_data_files_depends "${DATAFILE_DIR}/extcap")
-
 # faq.txt is handled separately below.
 set(_help_source_files
        help/capture_filters.txt
@@ -2249,40 +2229,6 @@ macro(set_extra_executable_properties _executable _folder)
        endif()
 endmacro()
 
-macro(set_extcap_executable_properties _executable)
-       set_target_properties(${_executable} PROPERTIES FOLDER "Executables/Extcaps")
-
-       set(PROGLIST ${PROGLIST} ${_executable})
-
-       if(WIN32)
-               set_target_properties(${_executable} PROPERTIES
-                       LINK_FLAGS "${WS_LINK_FLAGS}"
-                       RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/extcap
-                       RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/run/Debug/extcap
-                       RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/run/Release/extcap
-                       RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_BINARY_DIR}/run/MinSizeRel/extcap
-                       RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/run/RelWithDebInfo/extcap
-               )
-       else()
-               set_target_properties(${_executable} PROPERTIES
-                       LINK_FLAGS "${WS_LINK_FLAGS}"
-                       RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/extcap
-               )
-               if(ENABLE_APPLICATION_BUNDLE)
-                       set_target_properties(${_executable} PROPERTIES
-                               RUNTIME_OUTPUT_DIRECTORY run/Wireshark.app/Contents/MacOS/extcap
-                       )
-                       # Add a wrapper script which runs each executable from the
-                       # correct location. This adds convenience but makes debugging
-                       # more difficult.
-                       file(REMOVE ${CMAKE_BINARY_DIR}/run/${_executable})
-                       file(WRITE ${CMAKE_BINARY_DIR}/run/${_executable} "#!/bin/sh\n")
-                       file(APPEND ${CMAKE_BINARY_DIR}/run/${_executable} "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/extcap/${_executable} \"\$\@\"\n")
-                       execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/${_executable})
-               endif()
-       endif()
-endmacro()
-
 register_tap_files(tshark-tap-register.c
        ${TSHARK_TAP_SRC}
 )
@@ -2640,152 +2586,6 @@ if (WIN32)
        endif()
 endif()
 
-add_custom_target(extcaps)
-
-if(BUILD_androiddump)
-       if(EXTCAP_ANDROIDDUMP_LIBPCAP)
-               if(HAVE_LIBPCAP)
-                       set(androiddump_LIBS
-                               ui
-                               ${GLIB2_LIBRARIES}
-                               ${PCAP_LIBRARIES}
-                       )
-               else()
-                       message(FATAL_ERROR "You are trying to build androiddump with libpcap but do not have it")
-               endif()
-       else()
-               set(androiddump_LIBS
-                       ui
-                       wiretap
-                       ${GLIB2_LIBRARIES}
-                       ${ZLIB_LIBRARIES}
-                       ${CMAKE_DL_LIBS}
-               )
-       endif()
-       set(androiddump_FILES
-               extcap/androiddump.c
-               extcap/extcap-base.c
-       )
-
-       add_executable(androiddump WIN32 ${androiddump_FILES})
-       # XXX Shouldn't we add wsutil to androiddump_LIBS instead?
-       set_extcap_executable_properties(androiddump)
-       target_link_libraries(androiddump ${androiddump_LIBS})
-       install(TARGETS androiddump RUNTIME DESTINATION ${EXTCAP_DIR})
-       add_dependencies(extcaps androiddump)
-endif()
-
-if(BUILD_sshdump AND LIBSSH_FOUND)
-       set(sshdump_LIBS
-               wsutil
-               ${GLIB2_LIBRARIES}
-               ${CMAKE_DL_LIBS}
-               ${LIBSSH_LIBRARIES}
-       )
-       set(sshdump_FILES
-               extcap/sshdump.c
-               extcap/extcap-base.c
-               extcap/ssh-base.c
-       )
-
-       add_executable(sshdump WIN32 ${sshdump_FILES})
-       set_extcap_executable_properties(sshdump)
-       target_link_libraries(sshdump ${sshdump_LIBS})
-       target_include_directories(sshdump PUBLIC ${LIBSSH_INCLUDE_DIR})
-       install(TARGETS sshdump RUNTIME DESTINATION ${EXTCAP_DIR})
-       add_dependencies(extcaps sshdump)
-elseif (BUILD_sshdump)
-       #message( WARNING "Cannot find libssh, cannot build sshdump" )
-endif()
-
-if(BUILD_ciscodump AND LIBSSH_FOUND)
-       set(ciscodump_LIBS
-               writecap
-               wsutil
-               ${GLIB2_LIBRARIES}
-               ${CMAKE_DL_LIBS}
-               ${LIBSSH_LIBRARIES}
-       )
-       set(ciscodump_FILES
-               extcap/ciscodump.c
-               extcap/extcap-base.c
-               extcap/ssh-base.c
-       )
-
-       add_executable(ciscodump WIN32 ${ciscodump_FILES})
-       set_extcap_executable_properties(ciscodump)
-       target_link_libraries(ciscodump ${ciscodump_LIBS})
-       target_include_directories(ciscodump PUBLIC ${LIBSSH_INCLUDE_DIR})
-       install(TARGETS ciscodump RUNTIME DESTINATION ${EXTCAP_DIR})
-       add_dependencies(extcaps ciscodump)
-elseif (BUILD_ciscodump)
-       #message( WARNING "Cannot find libssh, cannot build ciscodump" )
-endif()
-
-if(BUILD_dpauxmon AND HAVE_LIBNL3)
-       set(dpauxmon_LIBS
-               ${GLIB2_LIBRARIES}
-               ${CMAKE_DL_LIBS}
-               wsutil
-               writecap
-               ${NL_LIBRARIES}
-       )
-       set(dpauxmon_FILES
-               extcap/dpauxmon.c
-               extcap/extcap-base.c
-       )
-
-       add_executable(dpauxmon WIN32 ${dpauxmon_FILES})
-       set_extcap_executable_properties(dpauxmon)
-       target_link_libraries(dpauxmon ${dpauxmon_LIBS})
-       target_include_directories(dpauxmon PUBLIC ${NL_INCLUDE_DIR})
-       install(TARGETS dpauxmon RUNTIME DESTINATION ${EXTCAP_DIR})
-       add_dependencies(extcaps dpauxmon)
-elseif (BUILD_dpauxmon)
-       #message( WARNING "Cannot find libnl3, cannot build dpauxmon" )
-endif()
-
-if(BUILD_udpdump)
-       set(udpdump_LIBS
-               ${GLIB2_LIBRARIES}
-               ${CMAKE_DL_LIBS}
-               wsutil
-               writecap
-       )
-       set(udpdump_FILES
-               extcap/udpdump.c
-               extcap/extcap-base.c
-       )
-
-       add_executable(udpdump WIN32 ${udpdump_FILES})
-       set_extcap_executable_properties(udpdump)
-       target_link_libraries(udpdump ${udpdump_LIBS})
-       install(TARGETS udpdump RUNTIME DESTINATION ${EXTCAP_DIR})
-       add_dependencies(extcaps udpdump)
-endif()
-
-if(BUILD_randpktdump)
-       set(randpktdump_LIBS
-               randpkt_core
-               ui
-               wiretap
-               ${GLIB2_LIBRARIES}
-               ${ZLIB_LIBRARIES}
-               ${CMAKE_DL_LIBS}
-       )
-       set(randpktdump_FILES
-               extcap/extcap-base.c
-               extcap/randpktdump.c
-       )
-
-       add_executable(randpktdump WIN32 ${randpktdump_FILES})
-       # XXX Shouldn't we add wsutil to randpktdump_LIBS instead?
-       set_extcap_executable_properties(randpktdump)
-       target_link_libraries(randpktdump ${randpktdump_LIBS})
-       install(TARGETS randpktdump RUNTIME DESTINATION ${EXTCAP_DIR})
-       add_dependencies(extcaps randpktdump)
-endif()
-
 if (MAXMINDDB_FOUND)
        set(mmdbresolve_LIBS
                # Note: libmaxminddb is not GPL-2 compatible.
@@ -2911,7 +2711,6 @@ if(RPMBUILD_EXECUTABLE)
        execute_process(
                COMMAND ${PERL_EXECUTABLE}
                        ${CMAKE_SOURCE_DIR}/make-version.pl
-                       --set-vcs ${GIT_BIN_PARAM}
                        ${CMAKE_SOURCE_DIR}
        )
 
@@ -2964,10 +2763,6 @@ set(CLEAN_C_FILES
        ${captype_FILES}
        ${editcap_FILES}
        ${idl2wrs_FILES}
-       ${dumpcap_FILES}
-       ${androiddump_FILES}
-       ${sshdump_FILES}
-       ${ciscodump_FILES}
        ${mmdbresolve_FILES}
 )
 
@@ -3153,7 +2948,8 @@ separate_arguments(TEST_EXTRA_ARGS)
 foreach(_suite_name ${_test_suite_list})
        add_test(
                NAME ${_suite_name}
-               COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/test/test.py
+               COMMAND ${CMAKE_COMMAND} -E env PYTHONIOENCODING=UTF-8
+                       ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/test/test.py
                        --verbose
                        --program-path ${_test_suite_program_path}
                        ${TEST_EXTRA_ARGS}