Move merge.{h,c} into wiretap: these modules use wiretap to merge files.
[metze/wireshark/wip.git] / CMakeLists.txt
index 2c7bc929ed0c79776baf2b3424691b6d586d05b2..29f65b6e2b076f43bfb840c0d57c383e37d578b9 100644 (file)
 #
 # 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)
+project(Wireshark C CXX)
 
 cmake_minimum_required(VERSION 2.6)
 set(CMAKE_BACKWARDS_COMPATIBILITY 2.6)
@@ -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_VERSION
-               ${VERSIONLINE}
+               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_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
 
@@ -105,61 +117,74 @@ include(CMakeOptions.txt)
 
 set(WIRESHARK_C_FLAGS
        -O2
+       -g
        -Wall
        -W
        -Wextra
-       -Wdeclaration-after-statement
        -Wendif-labels
        -Wpointer-arith
-       -Wno-pointer-sign
        -Warray-bounds
-       -Wcast-align
        -Wformat-security
+       -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
-       -fexcess-precision=fast
+       -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
-       -Wbad-function-cast
+       -Wcast-align
        -Wcast-qual
-       -Waddress
-       -Warray-bounds
-       -Wattributes
-       -Wdiv-by-zero
        -Wformat-security
-       -Wignored-qualifiers
-       -Wpragmas
        -Wredundant-decls
-       -Wvla
-       -Wc++-compat
-       -Wjump-misses-init
-       # packet-ncp2222.inc prevents this from going into all warnings
-       -Wwrite-strings
-       # GLib blocks this for now.
-       -Wstrict-prototypes
        # All the registration functions block these for now.
-       -Wmissing-prototypes
        -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
+       # 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
 )
@@ -174,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)
@@ -185,10 +231,10 @@ else()
        unset(WERROR)
 endif()
 
-if(CMAKE_COMPILER_IS_GNUCC)
-       add_definitions( -D_U_=__attribute__\(\(unused\)\) )
+if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER MATCHES ".*clang" OR APPLE)
+       set (C_UNUSED "__attribute__((unused))" )
 else()
-       add_definitions( -D_U_=\"\" )
+       set (C_UNUSED "" )
 endif()
 
 set(WIRESHARK_LD_FLAGS
@@ -234,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)
 
@@ -241,7 +288,7 @@ if(ENABLE_PCAP)
        set(PACKAGELIST ${PACKAGELIST} PCAP)
 endif()
 
-#Build the gui ?
+# Build the GTK-GUI?
 if(BUILD_wireshark)
        if(ENABLE_GTK3)
                set(PACKAGELIST ${PACKAGELIST} GTK3)
@@ -253,6 +300,18 @@ if(BUILD_wireshark)
        endif()
 endif()
 
+# Build the Qt GUI?
+if(BUILD_qtshark)
+       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
 if(ENABLE_SMI)
        set(PACKAGELIST ${PACKAGELIST} SMI)
@@ -301,13 +360,17 @@ if(ENABLE_GEOIP)
        set(PACKAGELIST ${PACKAGELIST} GEOIP)
 endif()
 
+if(ENABLE_NETLINK)
+       set(PACKAGELIST ${PACKAGELIST} NL)
+endif()
+
 # Capabilities
 if(ENABLE_CAP)
        set(PACKAGELIST ${PACKAGELIST} CAP)
 endif()
 
 if(ENABLE_PYTHON)
-       set(PACKAGELIST ${PACKAGELIST} PYTHON)
+       set(PACKAGELIST ${PACKAGELIST} PythonLibs)
 endif()
 
 set(PACKAGELIST ${PACKAGELIST} YAPP)
@@ -315,10 +378,22 @@ 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 "Qt4")
+               set(PACKAGE_VAR "QT")
+       elseif(${PACKAGE} STREQUAL "PythonInterp")
+               set(PACKAGE_VAR "PYTHON")
+       elseif(${PACKAGE} STREQUAL "PythonLibs")
+               set(PACKAGE_VAR "PYTHON")
+       else()
+               set(PACKAGE_VAR ${PACKAGE})
+       endif()
        if(${PACKAGE}_OPTIONS)
                find_package(${PACKAGE} ${${PACKAGE}_OPTIONS})
        elseif(${PACKAGE}_REQUIRED)
@@ -326,12 +401,18 @@ foreach(PACKAGE ${PACKAGELIST})
        else()
                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()
 
@@ -344,7 +425,7 @@ if(HAVE_LIBPYTHON)
 endif()
 if(HAVE_LIBLUA)
        set(HAVE_LUA_H 1)
-       set(HAVE_LUA_5_1 1)
+       set(HAVE_LUA 1)
 endif()
 if(HAVE_LIBKERBEROS)
        set(HAVE_KERBEROS 1)
@@ -364,6 +445,9 @@ endif()
 if(ENABLE_AIRPCAP)
        set(HAVE_AIRPCAP 1)
 endif()
+if(HAVE_LIBNL AND ENABLE_AIRPCAP)
+       message(ERROR "Airpcap and Libnl support are mutually exclusive")
+endif()
 # No matter which version of GTK is present
 if(GTK2_FOUND OR GTK3_FOUND)
        set(GTK_FOUND ON)
@@ -372,7 +456,20 @@ endif()
 if(HAVE_LIBZLIB)
        set(HAVE_LIBZ 1)
 endif()
-
+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 ?
@@ -388,7 +485,6 @@ if(ENABLE_PLUGINS)
                plugins/asn1
                plugins/docsis
                plugins/ethercat
-               plugins/giop
                plugins/gryphon
                plugins/irda
                plugins/m2m
@@ -399,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)
@@ -415,18 +512,30 @@ 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()
 
+if(BUILD_qtshark AND QT_FOUND)
+       add_subdirectory( ui/qt )
+endif()
+
+
 # Basedir where to install guides
-set(DOC_DIR "$ENV{docdir}")
+set(DOC_DIR "$ENV{docdir}" CACHE FILEPATH "Installation directory for ug and dg pdfs.")
 message(STATUS "docdir: ${DOC_DIR}")
 
 if(ENABLE_GUIDES)
@@ -438,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
@@ -464,13 +574,24 @@ 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
 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
        ${CMAKE_BINARY_DIR}/epan
        ${CMAKE_BINARY_DIR}/wiretap
@@ -495,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
@@ -514,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
 )
 
@@ -533,65 +642,58 @@ 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
-       util.c
-       tap-megaco-common.c
-       tap-rtp-common.c
        version_info.c
 )
 
 set(TSHARK_TAP_SRC
-       tap-afpstat.c
-       tap-ansi_astat.c
-       tap-bootpstat.c
-       tap-camelcounter.c
-       tap-camelsrt.c
-       tap-comparestat.c
-       tap-dcerpcstat.c
-       tap-diameter-avp.c
-       tap-expert.c
-       tap-funnel.c
-       tap-gsm_astat.c
-       tap-h225counter.c
-       tap-h225rassrt.c
-       tap-hosts.c
-       tap-httpstat.c
-       tap-icmpstat.c
-       tap-icmpv6stat.c
-       tap-iostat.c
-       tap-iousers.c
-       tap-macltestat.c
-       tap-mgcpstat.c
-       tap-megacostat.c
-       tap-protocolinfo.c
-       tap-protohierstat.c
-       tap-radiusstat.c
-       tap-rlcltestat.c
-       tap-rpcstat.c
-       tap-rpcprogs.c
-       tap-rtp.c
-       tap-rtspstat.c
-       tap-scsistat.c
-       tap-sctpchunkstat.c
-       tap-sipstat.c
-       tap-smbsids.c
-       tap-smbstat.c
-       tap-stats_tree.c
-       tap-sv.c
-       tap-wspstat.c
+       ui/cli/tap-afpstat.c
+       ui/cli/tap-ansi_astat.c
+       ui/cli/tap-bootpstat.c
+       ui/cli/tap-camelcounter.c
+       ui/cli/tap-camelsrt.c
+       ui/cli/tap-comparestat.c
+       ui/cli/tap-dcerpcstat.c
+       ui/cli/tap-diameter-avp.c
+       ui/cli/tap-expert.c
+       ui/cli/tap-follow.c
+       ui/cli/tap-funnel.c
+       ui/cli/tap-gsm_astat.c
+       ui/cli/tap-h225counter.c
+       ui/cli/tap-h225rassrt.c
+       ui/cli/tap-hosts.c
+       ui/cli/tap-httpstat.c
+       ui/cli/tap-icmpstat.c
+       ui/cli/tap-icmpv6stat.c
+       ui/cli/tap-iostat.c
+       ui/cli/tap-iousers.c
+       ui/cli/tap-macltestat.c
+       ui/cli/tap-mgcpstat.c
+       ui/cli/tap-megacostat.c
+       ui/cli/tap-protocolinfo.c
+       ui/cli/tap-protohierstat.c
+       ui/cli/tap-radiusstat.c
+       ui/cli/tap-rlcltestat.c
+       ui/cli/tap-rpcstat.c
+       ui/cli/tap-rpcprogs.c
+       ui/cli/tap-rtp.c
+       ui/cli/tap-rtspstat.c
+       ui/cli/tap-scsistat.c
+       ui/cli/tap-sctpchunkstat.c
+       ui/cli/tap-sipstat.c
+       ui/cli/tap-smbsids.c
+       ui/cli/tap-smbstat.c
+       ui/cli/tap-stats_tree.c
+       ui/cli/tap-sv.c
+       ui/cli/tap-wspstat.c
 )
 
 set(INSTALL_DIRS
        diameter
-       docbook
        dtds
        help
        radius
@@ -609,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
@@ -616,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
@@ -645,21 +750,9 @@ set(LIBEPAN_LIBS
                ${M_LIBRARIES}
 )
 
-if(BUILD_wireshark AND GTK_FOUND)
-       set(wireshark_LIBS
-               ui
-               ${GTK2_LIBRARIES}
-               ${GTK3_LIBRARIES}
-               ${GTHREAD2_LIBRARIES}
-               codecs
-               ${PORTAUDIO_LIBRARIES}
-               ${LIBEPAN_LIBS}
-               ${APPLE_CORE_SERVICES_LIBRARY}
-               ${APPLE_COCOA_LIBRARY}
-       )
+if( (BUILD_wireshark AND GTK_FOUND) OR (BUILD_qtshark AND QT_FOUND) )
        set(wireshark_FILES
                airpcap_loader.c
-               alert_box.c
                capture.c
                capture_info.c
                capture_opts.c
@@ -668,16 +761,32 @@ if(BUILD_wireshark AND GTK_FOUND)
                file.c
                fileset.c
                filters.c
-               g711.c
-               merge.c
+               iface_monitor.c
                proto_hier_stats.c
-               recent.c
                summary.c
-               tempfile.c
-               u3.c
+               ws80211_utils.c
                ${SHARK_COMMON_CAPTURE_SRC}
                ${WIRESHARK_COMMON_SRC}
        )
+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_SYSTEM_CONFIGURATION_LIBRARY}
+               ${NL_LIBRARIES}
+       )
+       # qtshark and wireshark share wireshark_FILES
+
        add_executable(wireshark ${wireshark_FILES})
        add_dependencies(wireshark svnversion)
        set_target_properties(wireshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
@@ -685,19 +794,43 @@ if(BUILD_wireshark AND GTK_FOUND)
        install(TARGETS wireshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 endif()
 
+if(BUILD_qtshark AND QT_FOUND)
+       set(qtshark_LIBS
+               qtui
+               ui
+               ${QT_LIBRARIES}
+               ${GTHREAD2_LIBRARIES}
+               codecs
+               ${PORTAUDIO_LIBRARIES}
+               ${LIBEPAN_LIBS}
+               ${APPLE_APPLICATION_SERVICES_LIBRARY}
+               ${APPLE_CORE_FOUNDATION_LIBRARY}
+               ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
+               ${NL_LIBRARIES}
+       )
+       # qtshark and wireshark share wireshark_FILES
+
+       add_executable(qtshark ${wireshark_FILES})
+       add_dependencies(qtshark svnversion)
+       set_target_properties(qtshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
+       target_link_libraries(qtshark ${qtshark_LIBS})
+       install(TARGETS qtshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+endif()
+
 register_tap_files(tshark-tap-register.c
        ${TSHARK_TAP_SRC}
 )
 
 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
                ${TSHARK_TAP_SRC}
@@ -714,11 +847,13 @@ 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}
                rawshark.c
+               ui/util.c
        )
        add_executable(rawshark ${rawshark_FILES})
        add_dependencies(rawshark svnversion)
@@ -733,7 +868,7 @@ if(BUILD_dftest)
        )
        set(dftest_FILES
                dftest.c
-               util.c
+               ui/util.c
        )
        add_executable(dftest ${dftest_FILES})
        set_target_properties(dftest PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
@@ -763,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}
@@ -790,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)
@@ -800,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
@@ -826,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})
@@ -847,21 +999,24 @@ if(BUILD_dumpcap AND PCAP_FOUND)
                ${GLIB2_LIBRARIES}
                ${GTHREAD2_LIBRARIES}
                ${ZLIB_LIBRARIES}
-               ${APPLE_COCOA_LIBRARY}
+               ${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}
        )
        add_executable(dumpcap ${dumpcap_FILES})
@@ -907,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 )
@@ -924,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
@@ -943,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
@@ -1007,3 +1169,20 @@ install(
        PATTERN "Makefile.*" EXCLUDE
        PATTERN "faq.py" EXCLUDE
 )
+
+
+if(DOC_DIR)
+       message(STATUS "Docdir install: ${DOC_DIR}")
+       INSTALL(
+               DIRECTORY
+                       ${CMAKE_BINARY_DIR}/docbook/
+               DIRECTORY_PERMISSIONS
+                       OWNER_EXECUTE OWNER_WRITE OWNER_READ
+                       GROUP_EXECUTE GROUP_READ
+                       WORLD_EXECUTE WORLD_READ
+               DESTINATION
+                       ${DOC_DIR}/guides
+               FILES_MATCHING
+               PATTERN "*.pdf"
+       )
+endif()