Move merge.{h,c} into wiretap: these modules use wiretap to merge files.
[metze/wireshark/wip.git] / CMakeLists.txt
index b90758957ee8f28ffb68e91a3880663a24d4eb58..29f65b6e2b076f43bfb840c0d57c383e37d578b9 100644 (file)
@@ -18,7 +18,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 #
 
 project(Wireshark C CXX)
@@ -33,42 +33,53 @@ if(COMMAND cmake_policy)
 #      cmake_policy(SET CMP0015 NEW)
 endif(COMMAND cmake_policy)
 
-# set(PROJECT_VERSION "1.3.4-rc5")
-# set(PROJECT_VERSION "1.3.4rc5")
-# set(PROJECT_VERSION "1.3.4")
-# If not set, copy over Wireshark version from configure.in AC_INIT
-if(NOT PROJECT_VERSION)
+# set(PROJECT_MAJOR_VERSION 1)
+# set(PROJECT_MINOR_VERSION 9)
+# set(PROJECT_PATCH_VERSION 0)
+# set(PROJECT_VERSION_EXTENSION "-rc5")
+# If not set, copy over Wireshark version from configure.ac
+if(NOT PROJECT_MAJOR_VERSION)
        file(STRINGS
-               ${CMAKE_SOURCE_DIR}/configure.in
-               VERSIONLINE
-               REGEX "\\(wireshark, .*\\)"
+               ${CMAKE_SOURCE_DIR}/configure.ac
+               PROJECT_MAJOR_VERSION_TMP
+               REGEX "^m4_define\\(\\[?version_major\\]?, *\\[?[0-9]+\\]?\\)"
        )
-       string(REGEX REPLACE ".*\\(wireshark, (.*)\\).*"
+       file(STRINGS
+               ${CMAKE_SOURCE_DIR}/configure.ac
+               PROJECT_MINOR_VERSION_TMP
+               REGEX "^m4_define\\(\\[?version_minor\\]?, *\\[?[0-9]+\\]?\\)"
+       )
+       file(STRINGS
+               ${CMAKE_SOURCE_DIR}/configure.ac
+               PROJECT_PATCH_VERSION_TMP
+               REGEX "^m4_define\\(\\[?version_micro\\]?, *\\[?[0-9]+\\]?\\)"
+       )
+       # XXX pull VERSION_EXTENSION out of configure.ac ?
+
+       string(REGEX REPLACE "m4_define\\(\\[?version_major\\]?, *\\[?([0-9]+)\\]?\\)"
+               "\\1"
+               PROJECT_MAJOR_VERSION
+               ${PROJECT_MAJOR_VERSION_TMP}
+       )
+       string(REGEX REPLACE "m4_define\\(\\[?version_minor\\]?, *\\[?([0-9]+)\\]?\\)"
+               "\\1"
+               PROJECT_MINOR_VERSION
+               ${PROJECT_MINOR_VERSION_TMP}
+       )
+       string(REGEX REPLACE "m4_define\\(\\[?version_micro\\]?, *\\[?([0-9]+)\\]?\\)"
                "\\1"
-               PROJECT_VERSION
-               ${VERSIONLINE}
+               PROJECT_PATCH_VERSION
+               ${PROJECT_PATCH_VERSION_TMP}
        )
 endif()
-string(REGEX REPLACE "([0-9]+)\\..*"
-       "\\1"
-       PROJECT_MAJOR_VERSION
-       ${PROJECT_VERSION}
-)
-string(REGEX REPLACE ".*\\.([0-9]+)\\..*"
-       "\\1"
-       PROJECT_MINOR_VERSION
-       ${PROJECT_VERSION}
-)
-string(REGEX REPLACE ".*\\..*\\.([0-9]+).*"
-       "\\1"
-       PROJECT_PATCH_VERSION
-       ${PROJECT_VERSION}
-)
-string(REGEX REPLACE ".*\\..*\\.[0-9]+(.*)"
-       "\\1"
-       PROJECT_VERSION_EXTENSION
-       ${PROJECT_VERSION}
-)
+
+
+if(PROJECT_VERSION_EXTENSION)
+       set(PROJECT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}${PROJECT_VERSION_EXTENSION})
+else()
+       set(PROJECT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION})
+endif()
+
 message(STATUS "V: ${PROJECT_VERSION}, MaV: ${PROJECT_MAJOR_VERSION}, MiV: ${PROJECT_MINOR_VERSION}, PL: ${PROJECT_PATCH_VERSION}, EV: ${PROJECT_VERSION_EXTENSION}.")
 
 #Where to find local cmake scripts
@@ -76,6 +87,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
 INCLUDE(UseLemon)
 INCLUDE(UseMakeDissectorReg)
 INCLUDE(UseMakeTapReg)
+INCLUDE(UseAsn2Wrs)
 
 # Under linux the release mode (CMAKE_BUILD_TYPE=release) defines NDEBUG
 
@@ -112,60 +124,67 @@ set(WIRESHARK_C_FLAGS
        -Wendif-labels
        -Wpointer-arith
        -Warray-bounds
-       -Wcast-align
        -Wformat-security
-       -fexcess-precision=fast
+       -Wshorten-64-to-32
+       -Wvla
+       -Waddress
+       -Warray-bounds
+       -Wattributes
+       -Wdiv-by-zero
+       -Wignored-qualifiers
+       -Wno-overlength-strings
+       -Wwrite-strings
+       -Wno-long-long
+)
+if (NOT APPLE)
+       set(WIRESHARK_C_FLAGS ${WIRESHARK_C_FLAGS}
+           -fexcess-precision=fast
+           -Wpragmas)
+endif()
 
+set(WIRESHARK_C_ONLY_FLAGS
        # The following are C only, not C++
+       -Wc++-compat
        -Wdeclaration-after-statement
+       -Wshadow
        -Wno-pointer-sign
        -Wold-style-definition
+       -Wshadow
+       -Wstrict-prototypes
 )
+if (NOT APPLE)
+       set(WIRESHARK_C_ONLY_FLAGS ${WIRESHARK_C_ONLY_FLAGS}
+           -Wlogical-op
+           -Wjump-misses-init)
+endif()
 
 set(WIRESHARK_EXTRA_C_FLAGS
        -pedantic
        -Woverflow
-       -Wlogical-op
-       -Wno-overlength-strings
        -fstrict-overflow -Wstrict-overflow=4
        -Wunreachable-code
        -Wunsafe-loop-optimizations
-       -Wno-long-long
+       -Wcast-align
        -Wcast-qual
-       -Waddress
-       -Warray-bounds
-       -Wattributes
-       -Wdiv-by-zero
        -Wformat-security
-       -Wignored-qualifiers
-       -Wpragmas
        -Wredundant-decls
-       -Wvla
-       # packet-ncp2222.inc prevents this from going into all warnings
-       -Wwrite-strings
        # All the registration functions block these for now.
        -Wmissing-declarations
-       # Problem with packet-afs.c
-       -Wshadow
-       # More cleanup needed for this on LP64
-       -Wshorten-64-to-32
+)
 
+set(WIRESHARK_EXTRA_C_ONLY_FLAGS
        # The following are C only, not C++
        -Wbad-function-cast
-       -Wc++-compat
-       -Wjump-misses-init
-       # GLib blocks this for now.
-       -Wstrict-prototypes
        # All the registration functions block these for now.
        -Wmissing-prototypes
 )
 
 if(ENABLE_EXTRA_GCC_CHECKS)   # This overrides -Werror
        set(WIRESHARK_C_FLAGS ${WIRESHARK_C_FLAGS} ${WIRESHARK_EXTRA_C_FLAGS})
+       set(WIRESHARK_C_ONLY_FLAGS ${WIRESHARK_C_ONLY_FLAGS} ${WIRESHARK_EXTRA_C_ONLY_FLAGS})
 endif()
 
 add_definitions(
-       -DHAVE_CONFIG_H
        -DG_DISABLE_DEPRECATED
        -DG_DISABLE_SINGLE_INCLUDES
 )
@@ -180,10 +199,31 @@ foreach(THIS_FLAG ${WIRESHARK_C_FLAGS})
        set(V WS_C_FLAG_VALID${C})
        check_c_compiler_flag(${${F}} ${V})
        if (${${V}})
-               add_definitions(${${F}})
+               set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${${F}}")
+               set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${F}}")
        endif()
        math(EXPR C "${C} + 1")
 endforeach()
+# Continue increasing C from previous loop
+foreach(THIS_FLAG ${WIRESHARK_C_ONLY_FLAGS})
+       set(F WS_C_FLAG_${C})
+       set(${F} ${THIS_FLAG})
+       set(V WS_C_FLAG_VALID${C})
+       check_c_compiler_flag(${${F}} ${V})
+       if (${${V}})
+               set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${${F}}")
+       endif()
+       math(EXPR C "${C} + 1")
+endforeach()
+message(STATUS "C-Flags: ${CMAKE_C_FLAGS}\nCXX-Flags: ${CMAKE_CXX_FLAGS}")
+
+check_c_compiler_flag(-fvisibility=hidden FVHIDDEN)
+if((FVHIDDEN))
+       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
+else() # TODO add alternate compiler flags for hiding symbols
+       message(WARNING "Hiding shared library symbols is not supported by the compiler."
+               " All shared library symbols will be exported.")
+endif()
 
 if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_GCC_CHECKS)
        check_c_compiler_flag(-Werror WERROR)
@@ -191,7 +231,7 @@ else()
        unset(WERROR)
 endif()
 
-if(CMAKE_COMPILER_IS_GNUCC)
+if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER MATCHES ".*clang" OR APPLE)
        set (C_UNUSED "__attribute__((unused))" )
 else()
        set (C_UNUSED "" )
@@ -240,6 +280,7 @@ set(GLIB2_MIN_VERSION 2.14.0)
 set(GTHREAD2_REQUIRED)
 set(PCAP_REQUIRED)
 set(M_REQUIRED)
+set(PythonInterp_FIND_VERSION 2)
 
 set(PACKAGELIST ${PACKAGELIST} HtmlViewer)
 
@@ -261,8 +302,14 @@ endif()
 
 # Build the Qt GUI?
 if(BUILD_qtshark)
-       set(PACKAGELIST ${PACKAGELIST} QT)
-       # set(QT_OPTIONS 4.7.1 REQUIRED QtCore QtGui)
+       if(ENABLE_QT5)
+               set(PACKAGELIST ${PACKAGELIST} Qt5Widgets Qt5PrintSupport Qt5LinguistTools)
+               set(QT_VERSION 5)
+       else()
+               set(PACKAGELIST ${PACKAGELIST} Qt4)
+               # set(Qt4_OPTIONS 4.7.1 REQUIRED QtCore QtGui)
+               set(QT_VERSION 4)
+       endif()
 endif()
 
 # SMI SNMP
@@ -323,7 +370,7 @@ if(ENABLE_CAP)
 endif()
 
 if(ENABLE_PYTHON)
-       set(PACKAGELIST ${PACKAGELIST} PYTHON)
+       set(PACKAGELIST ${PACKAGELIST} PythonLibs)
 endif()
 
 set(PACKAGELIST ${PACKAGELIST} YAPP)
@@ -331,28 +378,41 @@ set(PACKAGELIST ${PACKAGELIST} YAPP)
 set(PACKAGELIST ${PACKAGELIST} POD)
 
 
-set(PROGLIST text2pcap mergecap capinfos editcap dumpcap)
+set(PROGLIST text2pcap mergecap capinfos editcap reordercap dumpcap)
 
+#Sort the package list
+list(SORT PACKAGELIST)
+message(STATUS "Packagelist: ${PACKAGELIST}")
 #Let's loop the package list
 foreach(PACKAGE ${PACKAGELIST})
-       if(${PACKAGE} STREQUAL "QT")
-               set(PACKAGE_NAME "Qt4")
+       if(${PACKAGE} STREQUAL "Qt4")
+               set(PACKAGE_VAR "QT")
+       elseif(${PACKAGE} STREQUAL "PythonInterp")
+               set(PACKAGE_VAR "PYTHON")
+       elseif(${PACKAGE} STREQUAL "PythonLibs")
+               set(PACKAGE_VAR "PYTHON")
        else()
-               set(PACKAGE_NAME ${PACKAGE})
+               set(PACKAGE_VAR ${PACKAGE})
        endif()
        if(${PACKAGE}_OPTIONS)
-               find_package(${PACKAGE_NAME} ${${PACKAGE}_OPTIONS})
+               find_package(${PACKAGE} ${${PACKAGE}_OPTIONS})
        elseif(${PACKAGE}_REQUIRED)
-               find_package(${PACKAGE_NAME} REQUIRED)
+               find_package(${PACKAGE} REQUIRED)
        else()
-               find_package(${PACKAGE_NAME})
+               find_package(${PACKAGE})
        endif()
-       message(${PACKAGE}_FOUND)
-       if (${PACKAGE}_FOUND)
-               set(HAVE_LIB${PACKAGE} 1)
-               include_directories(${${PACKAGE}_INCLUDE_DIRS})
-               message(STATUS "${PACKAGE} includes: ${${PACKAGE}_INCLUDE_DIRS}")
-               message(STATUS "${PACKAGE} libs: ${${PACKAGE}_LIBRARIES}")
+       message(${PACKAGE_VAR}_FOUND)
+       if (${PACKAGE_VAR}_FOUND)
+               set(HAVE_LIB${PACKAGE_VAR} 1)
+               include_directories(${${PACKAGE_VAR}_INCLUDE_DIRS})
+               message(STATUS "${PACKAGE} includes: ${${PACKAGE_VAR}_INCLUDE_DIRS}")
+               message(STATUS "${PACKAGE} libs: ${${PACKAGE_VAR}_LIBRARIES}")
+               if (${PACKAGE}_DEFINITIONS)
+                       message(STATUS "${PACKAGE} definitions: ${${PACKAGE_VAR}_DEFINITIONS}")
+               endif()
+               if (${PACKAGE_VAR}_EXECUTABLE)
+                       message(STATUS "${PACKAGE} executable: ${${PACKAGE_VAR}_EXECUTABLE}")
+               endif()
        endif()
 endforeach()
 
@@ -396,14 +456,20 @@ endif()
 if(HAVE_LIBZLIB)
        set(HAVE_LIBZ 1)
 endif()
-# QT_LIBRARIES and QT_INCLUDES are not set above. They require extra magic:
-if(QT_FOUND)
+if (Qt5Widgets_FOUND)
+       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
+       if (Qt5_POSITION_INDEPENDENT_CODE)
+               set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+       endif()
+       set (QT_FOUND ON)
+       set (QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES})
+# If Qt4: QT_LIBRARIES and QT_INCLUDES are not set above. They require extra magic
+elseif(QT_FOUND)
        include(${QT_USE_FILE})
        include_directories(${QT_INCLUDE_DIR})
        message(STATUS "QT includes: ${QT_INCLUDE_DIR}")
        message(STATUS "QT libs: ${QT_LIBRARIES}")
 endif()
-
 include(ConfigureChecks.cmake)
 
 #Big or little endian ?
@@ -429,6 +495,7 @@ if(ENABLE_PLUGINS)
                plugins/unistim
                plugins/wimax
                plugins/wimaxasncp
+               plugins/wimaxmacphy
        )
 # It seems this stuff doesn't build with autofoo either...
 #      if(YAPP_FOUND)
@@ -445,12 +512,19 @@ foreach(PLUGIN_DIR ${PLUGIN_SRC_DIRS})
        add_subdirectory( ${PLUGIN_DIR} )
 endforeach()
 
+add_subdirectory( asn1 EXCLUDE_FROM_ALL )
 add_subdirectory( codecs )
 add_subdirectory( epan )
 add_subdirectory( tools/lemon )
 add_subdirectory( wiretap )
 add_subdirectory( wsutil )
 
+add_custom_target(dumpabi DEPENDS dumpabi-libwireshark dumpabi-libwiretap dumpabi-libwsutil color.h)
+
+if((BUILD_wireshark AND GTK_FOUND) OR (BUILD_qtshark AND QT_FOUND))
+       add_subdirectory( ui )
+endif()
+
 if(BUILD_wireshark AND GTK_FOUND)
        add_subdirectory( ui/gtk )
 endif()
@@ -473,20 +547,21 @@ if(ENABLE_PCAP_NG_DEFAULT)
 endif()
 
 #Platform specific
-if(UNIX)
-       set(WS_VAR_IMPORT "extern")
-endif()
+#if(UNIX)
+#endif()
 
 if(APPLE)
-#TODO verify that APPLE implies HAVE_OS_X_FRAMEWORKS
+       #
+       # We assume that APPLE means OS X so that we have the OS X
+       # frameworks.
+       #
        set(HAVE_OS_X_FRAMEWORKS 1)
-       FIND_LIBRARY (APPLE_CORE_SERVICES_LIBRARY CoreServices)
-       FIND_LIBRARY (APPLE_COCOA_LIBRARY Cocoa)
+       FIND_LIBRARY (APPLE_APPLICATION_SERVICES_LIBRARY ApplicationServices)
+       FIND_LIBRARY (APPLE_CORE_FOUNDATION_LIBRARY CoreFoundation)
+       FIND_LIBRARY (APPLE_SYSTEM_CONFIGURATION_LIBRARY SystemConfiguration)
 endif()
 
 if(WIN32)
-       add_definitions(-D_NEED_VAR_IMPORT_)
-       set(WS_VAR_IMPORT "__declspec(dllimport) extern")
        set(WS_MSVC_NORETURN "__declspec(noreturn)")
 
        # Disable deprecation
@@ -499,6 +574,14 @@ endif()
 
 configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h)
 
+set( configure_input "Built with CMake ${CMAKE_VERSION}" )
+set( VERSION ${PROJECT_VERSION} )
+
+configure_file(
+       ${CMAKE_SOURCE_DIR}/packaging/macosx/Info.plist.in
+       ${CMAKE_SOURCE_DIR}/packaging/macosx/Info.plist
+       @ONLY)
+
 include(FeatureSummary)
 #SET_FEATURE_INFO(NAME DESCRIPTION [URL [COMMENT] ]
 #FEATURE_SUMMARY(WHAT ALL) Requires removal of our local copy of FeatureSummary
@@ -506,6 +589,7 @@ PRINT_ENABLED_FEATURES()
 PRINT_DISABLED_FEATURES()
 
 link_directories(
+       ${CMAKE_BINARY_DIR}/ui
        ${CMAKE_BINARY_DIR}/ui/gtk
        ${CMAKE_BINARY_DIR}/ui/qt
        ${CMAKE_BINARY_DIR}/codecs
@@ -532,17 +616,6 @@ ADD_CUSTOM_COMMAND(
                ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
 )
 
-ADD_CUSTOM_COMMAND(
-       OUTPUT  ps.c
-       COMMAND ${PYTHON_EXECUTABLE}
-               ${CMAKE_CURRENT_SOURCE_DIR}/tools/rdps.py
-               ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
-               ps.c
-       DEPENDS
-               ${CMAKE_CURRENT_SOURCE_DIR}/tools/rdps.py
-               ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
-)
-
 if(UNIX)
        set(PLATFORM_SRC
                capture-pcap-util-unix.c
@@ -551,13 +624,12 @@ endif()
 
 if(WIN32)
        set(PLATFORM_SRC
-               capture-wpcap.c capture_wpcap_packet.c
+               capture-wpcap.c capture_wpcap_packet.c capture_win_ifnames.c
        )
 endif()
 
 set(WTAP_PLUGIN_SOURCES
        epan/plugins.c
-       epan/report_err.c
        epan/filesystem.c
 )
 
@@ -570,17 +642,11 @@ set(WIRESHARK_COMMON_SRC
        ${PLATFORM_SRC}
        capture-pcap-util.c
        cfile.c
+       cfutils.c
        clopts_common.c
-       disabled_protos.c
-       frame_data_sequence.c
-       packet-range.c
-       print.c
-       ps.c
+       frame_tvbuff.c
        svnversion.h
        sync_pipe_write.c
-       timestats.c
-       tap-megaco-common.c
-       tap-rtp-common.c
        version_info.c
 )
 
@@ -645,6 +711,8 @@ set(INSTALL_FILES
        ${CMAKE_BINARY_DIR}/dftest.html
        ${CMAKE_BINARY_DIR}/dumpcap.html
        ${CMAKE_BINARY_DIR}/editcap.html
+       ${CMAKE_BINARY_DIR}/asn2deb.html
+       ${CMAKE_BINARY_DIR}/idl2deb.html
        ${CMAKE_BINARY_DIR}/idl2wrs.html
        ipmap.html
        manuf
@@ -652,6 +720,7 @@ set(INSTALL_FILES
        pdml2html.xsl
        ${CMAKE_BINARY_DIR}/randpkt.html
        ${CMAKE_BINARY_DIR}/rawshark.html
+       ${CMAKE_BINARY_DIR}/reordercap.html
        services
        smi_modules
        ${CMAKE_BINARY_DIR}/text2pcap.html
@@ -692,16 +761,9 @@ if( (BUILD_wireshark AND GTK_FOUND) OR (BUILD_qtshark AND QT_FOUND) )
                file.c
                fileset.c
                filters.c
-               g711.c
                iface_monitor.c
-               merge.c
                proto_hier_stats.c
-               recent.c
                summary.c
-               tempfile.c
-               u3.c
-               ui/alert_box.c
-               ui/util.c
                ws80211_utils.c
                ${SHARK_COMMON_CAPTURE_SRC}
                ${WIRESHARK_COMMON_SRC}
@@ -711,15 +773,17 @@ endif()
 if(BUILD_wireshark AND GTK_FOUND)
        set(wireshark_LIBS
                gtkui
+               ui
                ${GTK2_LIBRARIES}
                ${GTK3_LIBRARIES}
                ${GTHREAD2_LIBRARIES}
                codecs
                ${PORTAUDIO_LIBRARIES}
                ${LIBEPAN_LIBS}
+               ${APPLE_APPLICATION_SERVICES_LIBRARY}
                ${APPLE_CORE_SERVICES_LIBRARY}
-               ${APPLE_COCOA_LIBRARY}
-               ${LIBNL_LIBRARIES}
+               ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
+               ${NL_LIBRARIES}
        )
        # qtshark and wireshark share wireshark_FILES
 
@@ -733,13 +797,16 @@ endif()
 if(BUILD_qtshark AND QT_FOUND)
        set(qtshark_LIBS
                qtui
+               ui
                ${QT_LIBRARIES}
                ${GTHREAD2_LIBRARIES}
                codecs
                ${PORTAUDIO_LIBRARIES}
                ${LIBEPAN_LIBS}
-               ${APPLE_CORE_SERVICES_LIBRARY}
-               ${APPLE_COCOA_LIBRARY}
+               ${APPLE_APPLICATION_SERVICES_LIBRARY}
+               ${APPLE_CORE_FOUNDATION_LIBRARY}
+               ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
+               ${NL_LIBRARIES}
        )
        # qtshark and wireshark share wireshark_FILES
 
@@ -756,16 +823,16 @@ register_tap_files(tshark-tap-register.c
 
 if(BUILD_tshark)
        set(tshark_LIBS
+               ui
                ${LIBEPAN_LIBS}
-               ${APPLE_COCOA_LIBRARY}
+               ${APPLE_CORE_FOUNDATION_LIBRARY}
+               ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
        )
        set(tshark_FILES
                capture_opts.c
                capture_sync.c
-               tempfile.c
                tshark-tap-register.c
                tshark.c
-               ui/util.c
                ${TSHARK_TAP_SRC}
                ${SHARK_COMMON_CAPTURE_SRC}
                ${WIRESHARK_COMMON_SRC}
@@ -780,7 +847,8 @@ endif()
 if(BUILD_rawshark AND PCAP_FOUND)
        set(rawshark_LIBS
                ${LIBEPAN_LIBS}
-               ${APPLE_COCOA_LIBRARY}
+               ${APPLE_CORE_FOUNDATION_LIBRARY}
+               ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
        )
        set(rawshark_FILES
                ${WIRESHARK_COMMON_SRC}
@@ -830,12 +898,13 @@ endif()
 
 if(BUILD_text2pcap)
        set(text2pcap_LIBS
-               wiretap
+               wsutil
                ${M_LIBRARIES}
                ${ZLIB_LIBRARIES}
        )
        set(text2pcap_CLEAN_FILES
                text2pcap.c
+               pcapio.c
        )
        set(text2pcap_FILES
                ${text2pcap_CLEAN_FILES}
@@ -857,8 +926,8 @@ if(BUILD_mergecap)
        )
        set(mergecap_FILES
                mergecap.c
-               merge.c
                svnversion.h
+               ${WTAP_PLUGIN_SOURCES}
        )
        add_executable(mergecap ${mergecap_FILES})
        add_dependencies(mergecap svnversion)
@@ -867,12 +936,29 @@ if(BUILD_mergecap)
        install(TARGETS mergecap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 endif()
 
+if(BUILD_reordercap)
+       set(reordercap_LIBS
+               wiretap
+               ${ZLIB_LIBRARIES}
+       )
+       set(reordercap_FILES
+               reordercap.c
+               svnversion.h
+               ${WTAP_PLUGIN_SOURCES}
+       )
+       add_executable(reordercap ${reordercap_FILES})
+       add_dependencies(reordercap svnversion)
+       set_target_properties(reordercap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
+       target_link_libraries(reordercap ${reordercap_LIBS})
+       install(TARGETS reordercap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+endif()
+
 if(BUILD_capinfos)
        set(capinfos_LIBS
                wiretap
+               wsutil
                ${ZLIB_LIBRARIES}
                ${GCRYPT_LIBRARIES}
-               ${APPLE_COCOA_LIBRARY}
        )
        set(capinfos_FILES
                capinfos.c
@@ -893,7 +979,6 @@ if(BUILD_editcap)
        set(editcap_FILES
                editcap.c
                epan/crypt/md5.c
-               epan/nstime.c
                ${WTAP_PLUGIN_SOURCES}
        )
        add_executable(editcap ${editcap_FILES})
@@ -914,21 +999,22 @@ if(BUILD_dumpcap AND PCAP_FOUND)
                ${GLIB2_LIBRARIES}
                ${GTHREAD2_LIBRARIES}
                ${ZLIB_LIBRARIES}
-               ${APPLE_COCOA_LIBRARY}
-               ${LIBNL_LIBRARIES}
+               ${APPLE_CORE_FOUNDATION_LIBRARY}
+               ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
+               ${NL_LIBRARIES}
        )
        set(dumpcap_FILES
                svnversion.h
                capture_opts.c
                capture-pcap-util.c
                capture_stop_conditions.c
+               cfutils.c
                clopts_common.c
                conditions.c
                dumpcap.c
                pcapio.c
                ringbuffer.c
                sync_pipe_write.c
-               tempfile.c
                version_info.c
                ws80211_utils.c
                ${PLATFORM_SRC}
@@ -976,10 +1062,13 @@ pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/capinfos 1 )
 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dftest 1 )
 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dumpcap 1 )
 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/editcap 1 )
+pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/asn2deb 1 )
+pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2deb 1 )
 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2wrs 1 )
 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/mergecap 1 )
 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/randpkt 1 )
 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/rawshark 1 )
+pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/reordercap 1 )
 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/text2pcap 1 )
 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/tshark 1 )
 pod2manhtml( wireshark 1 )
@@ -993,10 +1082,13 @@ add_custom_target(
                dftest.html
                dumpcap.html
                editcap.html
+               asn2deb.html
+               idl2deb.html
                idl2wrs.html
                mergecap.html
                randpkt.html
                rawshark.html
+               reordercap.html
                text2pcap.html
                tshark.html
                wireshark.html
@@ -1012,6 +1104,7 @@ set(MAN1_FILES
        ${CMAKE_BINARY_DIR}/mergecap.1
        ${CMAKE_BINARY_DIR}/randpkt.1
        ${CMAKE_BINARY_DIR}/rawshark.1
+       ${CMAKE_BINARY_DIR}/reordercap.1
        ${CMAKE_BINARY_DIR}/text2pcap.1
        ${CMAKE_BINARY_DIR}/tshark.1
        ${CMAKE_BINARY_DIR}/wireshark.1
@@ -1093,4 +1186,3 @@ if(DOC_DIR)
                PATTERN "*.pdf"
        )
 endif()
-