epan/dissectors/packet-dcerpc.* move ndr_pointer stuff to dcerpc_info and avoid globa...
[metze/wireshark/wip.git] / CMakeLists.txt
index 2b8e548aa68ee59e0f93b8d64cb84e84081250de..dd9b78c395404a1596fc290af6a474b1cad00dc9 100644 (file)
@@ -20,38 +20,43 @@ cmake_minimum_required(VERSION 3.13)
 if(POLICY CMP0083)
        cmake_policy(SET CMP0083 NEW)
 endif()
+if(POLICY CMP0092)
+       cmake_policy(SET CMP0092 NEW)
+endif()
 if(POLICY CMP0135)
        cmake_policy(SET CMP0135 NEW)
 endif()
 
+if(WIN32 AND NOT DEFINED ENV{MSYSTEM})
+       set(_project_name Wireshark)
+       set(_log_project_name Logray)
+else()
+       set(_project_name wireshark)
+       set(_log_project_name logray)
+endif()
+
+project(${_project_name} C CXX)
+
 if(WIN32)
+       set(_msystem False)
+       set(_repository False)
        if(DEFINED ENV{MSYSTEM})
                set(_msystem $ENV{MSYSTEM})
-               set(_repository False)
                message(STATUS "Using MSYS2 with MSYSTEM=${_msystem}")
-       else()
-               set(_msystem False)
+       elseif(MSVC)
                set(_repository True)
                message(STATUS "Using 3rd party repository")
+       else()
+               # Neither own package repository nor MSYS2 repository.
        endif()
        set(USE_MSYSTEM ${_msystem} CACHE INTERNAL "Use MSYS2 subsystem")
        set(HAVE_MSYSTEM ${USE_MSYSTEM}) # For config.h
        set(USE_REPOSITORY ${_repository} CACHE INTERNAL "Use Wireshark 3rd Party Repository")
 endif()
 
-if(WIN32 AND NOT USE_MSYSTEM)
-       set(_project_name Wireshark)
-       set(_log_project_name Logray)
-else()
-       set(_project_name wireshark)
-       set(_log_project_name logray)
-endif()
-
-project(${_project_name} C CXX)
-
 # Updated by tools/make-version.py
 set(PROJECT_MAJOR_VERSION 4)
-set(PROJECT_MINOR_VERSION 1)
+set(PROJECT_MINOR_VERSION 3)
 set(PROJECT_PATCH_VERSION 0)
 set(PROJECT_BUILD_VERSION 0)
 set(PROJECT_VERSION_EXTENSION "")
@@ -64,8 +69,8 @@ set(PROJECT_VERSION "${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT
 
 set(LOG_PROJECT_NAME ${_log_project_name})
 set(LOG_PROJECT_MAJOR_VERSION 0)
-set(LOG_PROJECT_MINOR_VERSION 8)
-set(LOG_PROJECT_PATCH_VERSION 3)
+set(LOG_PROJECT_MINOR_VERSION 9)
+set(LOG_PROJECT_PATCH_VERSION 0)
 set(LOG_PROJECT_VERSION "${LOG_PROJECT_MAJOR_VERSION}.${LOG_PROJECT_MINOR_VERSION}.${LOG_PROJECT_PATCH_VERSION}${PROJECT_VERSION_EXTENSION}")
 
 include( CMakeOptions.txt )
@@ -160,26 +165,23 @@ if(WIN32)
 
        if(WIRESHARK_TARGET_PLATFORM MATCHES "win32")
                message(FATAL_ERROR "Deprecated target platform ${WIRESHARK_TARGET_PLATFORM}. See https://gitlab.com/wireshark/wireshark/-/issues/17779 for details.")
-       elseif(NOT WIRESHARK_TARGET_PLATFORM MATCHES "x64" OR WIRESHARK_TARGET_PLATFORM MATCHES "arm64")
+       elseif(NOT (WIRESHARK_TARGET_PLATFORM MATCHES "x64" OR WIRESHARK_TARGET_PLATFORM MATCHES "arm64"))
                message(FATAL_ERROR "Invalid target platform: ${WIRESHARK_TARGET_PLATFORM}")
        endif()
 
        # Sanity check
-       if(MSVC)
-               if(DEFINED ENV{PLATFORM})
-                       string(TOLOWER $ENV{PLATFORM} _vs_platform)
-               else()
-                       set(_vs_platform "[undefined]") # x86
-               endif()
+       if(MSVC AND DEFINED ENV{PLATFORM})
+               string(TOLOWER $ENV{PLATFORM} _vs_platform)
                if(
                        (_vs_platform STREQUAL "x64" AND NOT WIRESHARK_TARGET_PLATFORM STREQUAL "x64")
                        OR
-                       (_vs_platform STREQUAL "[undefined]" AND NOT WIRESHARK_TARGET_PLATFORM STREQUAL "win32")
+                       (_vs_platform STREQUAL "arm64" AND NOT WIRESHARK_TARGET_PLATFORM STREQUAL "arm64")
                )
                        message(FATAL_ERROR "The PLATFORM environment variable (${_vs_platform})"
                                " doesn't match the generator platform (${WIRESHARK_TARGET_PLATFORM})")
                endif()
        endif()
+
        message(STATUS
                "Building for ${WIRESHARK_TARGET_PLATFORM}"
        )
@@ -230,8 +232,8 @@ if(WIN32)
        file(TO_CMAKE_PATH ${EXTRA_INSTALLER_DIR} _file_download_dir)
 
        # Download Npcap required by the Windows installer
-       set(NPCAP_VERSION "1.75")
-       set(NPCAP_SHA256 "9ac38dff01b48e18033e8a9015b27042ef847c8c84a9065961a30f8ae22d5245")
+       set(NPCAP_VERSION "1.78")
+       set(NPCAP_SHA256 "deeb39ae22a44ea2698c4a58732e621bc45b84686a444c405491fef946898d90")
        set(NPCAP_FILENAME "npcap-${NPCAP_VERSION}.exe")
        set(NPCAP_URL "${LIBS_URL}/Npcap/${NPCAP_FILENAME}")
        FetchContent_Declare(Npcap
@@ -287,12 +289,6 @@ if(WIN32 AND NOT USE_MSYSTEM)
        set(CMAKE_INSTALL_INCLUDEDIR "include")
        set(CMAKE_INSTALL_DATADIR ".")
        set(CMAKE_INSTALL_DOCDIR ".")
-else()
-       # By default INSTALL_DATADIR is set to INSTALL_DATAROOTDIR, set the
-       # proper value here.
-       set(CMAKE_INSTALL_DATADIR "share/${PROJECT_NAME}"
-               CACHE PATH "Read-only architecture-independent data"
-       )
 endif()
 include(GNUInstallDirs)
 
@@ -301,9 +297,9 @@ set(PROJECT_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}")
 # Make sure our executables can load our libraries if we install into
 # a non-default directory on Unix-like systems other than macOS.
 # https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling
-set(LIBRARY_INSTALL_RPATH "")
-set(EXECUTABLE_INSTALL_RPATH "")
-set(EXTCAP_INSTALL_RPATH "")
+set(LIBRARY_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}")
+set(EXECUTABLE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}")
+set(EXTCAP_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}")
 if(NOT (WIN32 OR APPLE OR USE_STATIC))
        # Try to set a RPATH for installed binaries if the library directory is
        # not already included in the default search list.
@@ -513,8 +509,9 @@ set_property(DIRECTORY
        PROPERTY COMPILE_DEFINITIONS
                "G_DISABLE_DEPRECATED"
                "G_DISABLE_SINGLE_INCLUDES"
-               $<$<OR:$<BOOL:${ENABLE_DEBUG}>,$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:WS_DEBUG>
-               $<$<OR:$<BOOL:${ENABLE_DEBUG_UTF_8}>,$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:WS_DEBUG_UTF_8>
+               $<$<OR:$<BOOL:${ENABLE_DEBUG}>,$<CONFIG:Debug>>:WS_DEBUG>
+               $<$<OR:$<AND:$<BOOL:${ENABLE_DEBUG}>,$<BOOL:${ENABLE_DEBUG_UTF_8}>>,$<CONFIG:Debug>>:WS_DEBUG_UTF_8>
+               $<$<BOOL:${ENABLE_ASSERT}>:ENABLE_ASSERT>
 )
 
 if(WIN32)
@@ -652,7 +649,7 @@ else() # ! MSVC
        if(APPLE)
                # MIN_MACOS_VERSION is used to set LSMinimumSystemVersion
                # in Info.plist, so start with something low.
-               set(MIN_MACOS_VERSION 10.10)
+               set(MIN_MACOS_VERSION 10.11)
                if(CMAKE_OSX_DEPLOYMENT_TARGET)
                        if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS MIN_MACOS_VERSION)
                                message(FATAL_ERROR "We don't support building for macOS < ${MIN_MACOS_VERSION}")
@@ -938,10 +935,10 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
        foreach(_lang C CXX)
                if(${_lang}_fmacro_prefix_map_old_new_VALID)
                        set(_flags CMAKE_${_lang}_FLAGS)
-                       set(${_flags} "${${_flags}} -fmacro-prefix-map=${CMAKE_SOURCE_DIR}/=")
-                       set(${_flags} "${${_flags}} -fmacro-prefix-map=${CMAKE_BINARY_DIR}/=")
+                       set(${_flags} "${${_flags}} -fmacro-prefix-map=\"${CMAKE_SOURCE_DIR}/\"=")
+                       set(${_flags} "${${_flags}} -fmacro-prefix-map=\"${CMAKE_BINARY_DIR}/\"=")
                        if(_relative_source_dir MATCHES "\\.\\.$")
-                               set(${_flags} "${${_flags}} -fmacro-prefix-map=${_relative_source_dir}/=")
+                               set(${_flags} "${${_flags}} -fmacro-prefix-map=\"${_relative_source_dir}/\"=")
                        endif()
                endif()
        endforeach()
@@ -1198,6 +1195,10 @@ find_package(GCRYPT "1.8.0" REQUIRED)
 # C Asynchronous resolver
 reset_find_package(CARES)
 find_package(CARES "1.13.0" REQUIRED)
+if (CARES_VERSION VERSION_GREATER_EQUAL "1.28.0")
+       # Suppress deprecation warnings.
+       add_compile_definitions(CARES_NO_DEPRECATED)
+endif ()
 find_package(LEX REQUIRED)
 find_package(Perl)
 find_package(PCRE2 REQUIRED)
@@ -1212,7 +1213,7 @@ if(BUILD_sshdump OR BUILD_ciscodump OR BUILD_wifidump)
 else()
        set(ENABLE_LIBSSH OFF)
 endif()
-ws_find_package(LIBSSH ENABLE_LIBSSH HAVE_LIBSSH "0.6")
+ws_find_package(LIBSSH ENABLE_LIBSSH HAVE_LIBSSH "0.8.5")
 
 ws_find_package(PCAP ENABLE_PCAP HAVE_LIBPCAP)
 ws_find_package(AIRPCAP ENABLE_AIRPCAP HAVE_AIRPCAP)
@@ -1221,6 +1222,7 @@ ws_find_package(Systemd BUILD_sdjournal HAVE_SYSTEMD)
 # Build one of the Qt GUIs?
 if(BUILD_wireshark OR BUILD_logray)
        if(USE_qt6)
+               set(qtver 6)
                if(DEFINED ENV{WIRESHARK_QT6_PREFIX_PATH})
                        list(APPEND CMAKE_PREFIX_PATH $ENV{WIRESHARK_QT6_PREFIX_PATH})
                endif()
@@ -1244,10 +1246,12 @@ if(BUILD_wireshark OR BUILD_logray)
                                Widgets
                                Concurrent
                                Core5Compat
+                               DBus
                        OPTIONAL_COMPONENTS
                                Multimedia
                )
        else(USE_qt6)
+               set(qtver 5)
                if(DEFINED ENV{WIRESHARK_QT5_PREFIX_PATH})
                        list(APPEND CMAKE_PREFIX_PATH $ENV{WIRESHARK_QT5_PREFIX_PATH})
                endif()
@@ -1276,6 +1280,10 @@ if(BUILD_wireshark OR BUILD_logray)
                if(WIN32)
                        list(APPEND QT5_PACKAGELIST Qt5WinExtras)
                endif()
+               if(NOT WIN32 AND NOT APPLE)
+                       # DBus is a core component of Qt6, but was an add-on in Qt5.
+                       list(APPEND QT5_OPTIONAL_PACKAGELIST Qt5DBus)
+               endif()
                foreach(_qt5_package IN LISTS QT5_PACKAGELIST)
                        find_package(${_qt5_package} REQUIRED ${QT5_FIND_PACKAGE_OPTIONS})
                        list(APPEND QT5_LIBRARIES ${${_qt5_package}_LIBRARIES})
@@ -1289,11 +1297,11 @@ if(BUILD_wireshark OR BUILD_logray)
                        list(APPEND QT5_COMPILE_DEFINITIONS ${${_qt5_package}_COMPILE_DEFINITIONS})
                endforeach()
 
-               if (Qt5Widgets_VERSION VERSION_LESS 5.10)
+               if (Qt5Widgets_VERSION VERSION_LESS 5.11)
                        message(FATAL_ERROR "Qt 5.12 or later is required.")
                endif()
                if (Qt5Widgets_VERSION VERSION_LESS 5.12)
-                       message(WARNING "Wireshark can be build with this version of Qt, though 5.12 or higher is recommended.")
+                       message(WARNING "Wireshark can be built with this version of Qt, though 5.12 or higher is recommended.")
                endif()
 
                if(APPLE AND "/usr/local/opt/qt5/lib/QtCore.framework" IN_LIST Qt5Core_INCLUDE_DIRS)
@@ -1314,6 +1322,9 @@ if(BUILD_wireshark OR BUILD_logray)
        if(Qt6Multimedia_FOUND OR Qt5Multimedia_FOUND)
                set(QT_MULTIMEDIA_LIB 1)
        endif()
+       if(Qt6DBus_FOUND OR Qt5DBus_FOUND)
+               set(QT_DBUS_LIB 1)
+       endif()
        if(NOT DEFINED MOC_OPTIONS)
                # Squelch moc verbose "nothing to do" output
                set(MOC_OPTIONS -nn)
@@ -1355,8 +1366,17 @@ ws_find_package(ZSTD ENABLE_ZSTD HAVE_ZSTD "1.0.0")
 # Enhanced HTTP/2 dissection
 ws_find_package(NGHTTP2 ENABLE_NGHTTP2 HAVE_NGHTTP2 "1.11.0")
 
+# Enhanced HTTP/3 dissection
+ws_find_package(NGHTTP3 ENABLE_NGHTTP3 HAVE_NGHTTP3)
+
 # Embedded Lua interpreter
-ws_find_package(LUA ENABLE_LUA HAVE_LUA "5.1")
+if(FETCH_lua)
+       # Download and build lua
+       include(${CMAKE_SOURCE_DIR}/cmake/external/lua53/Lua53.cmake)
+else()
+       set(LUA_FIND_VERSIONS "5.4;5.3" CACHE STRING "Lua versions valid for the build (as a list)")
+       ws_find_package(Lua ENABLE_LUA HAVE_LUA)
+endif()
 
 ws_find_package(NL ENABLE_NETLINK HAVE_LIBNL)
 
@@ -1485,14 +1505,14 @@ if (QT_FOUND)
                # https://doc.qt.io/qt-5.11/supported-platforms-and-configurations.html
                # https://doc.qt.io/qt-5.15/supported-platforms.html
                # https://doc-snapshots.qt.io/qt6-dev/supported-platforms.html
-               if(Qt${qtver}Widgets_VERSION VERSION_GREATER_EQUAL "6.0.0")
+               if(Qt${qtver}Widgets_VERSION VERSION_GREATER_EQUAL "6.5.0" AND MIN_MACOS_VERSION VERSION_LESS "11.0")
+                       set(MIN_MACOS_VERSION 11.0)
+               elseif(Qt${qtver}Widgets_VERSION VERSION_GREATER_EQUAL "6.0.0" AND MIN_MACOS_VERSION VERSION_LESS "10.14")
                        set(MIN_MACOS_VERSION 10.14)
-               elseif(Qt5Widgets_VERSION VERSION_GREATER_EQUAL "5.14.0")
+               elseif(Qt5Widgets_VERSION VERSION_GREATER_EQUAL "5.14.0" AND MIN_MACOS_VERSION VERSION_LESS "10.13")
                        set(MIN_MACOS_VERSION 10.13)
-               elseif(Qt5Widgets_VERSION VERSION_GREATER_EQUAL "5.12.0")
+               elseif(Qt5Widgets_VERSION VERSION_GREATER_EQUAL "5.12.0" AND MIN_MACOS_VERSION VERSION_LESS "10.12")
                        set(MIN_MACOS_VERSION 10.12)
-               elseif(Qt5Widgets_VERSION VERSION_GREATER_EQUAL "5.10.0")
-                       set(MIN_MACOS_VERSION 10.11)
                endif()
                if(CMAKE_OSX_DEPLOYMENT_TARGET AND CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS MIN_MACOS_VERSION)
                        message(FATAL_ERROR "Qt version ${Qt${qtver}Widgets_VERSION} requires CMAKE_OSX_DEPLOYMENT_TARGET (${CMAKE_OSX_DEPLOYMENT_TARGET}) >= ${MIN_MACOS_VERSION}")
@@ -1554,7 +1574,7 @@ if(ENABLE_CCACHE)
        endif()
 endif()
 
-# The top level checkAPIs target, add before subdirectory calls so it's avaiable to all
+# The top level checkAPIs target, add before subdirectory calls so it's available to all
 add_custom_target(checkAPI)
 set_target_properties(checkAPI
        PROPERTIES
@@ -1573,11 +1593,16 @@ include( UseCheckAPI )
 # If you change the nesting level be sure to check also the INSTALL_RPATH
 # target property.
 if(WIN32 AND NOT USE_MSYSTEM)
-       set(EXTCAP_INSTALL_LIBDIR "extcap" CACHE INTERNAL "The extcap dir")
+       set(EXTCAP_INSTALL_LIBDIR "extcap/${PROJECT_NAME}" CACHE INTERNAL "The Wireshark extcap dir")
+       if (BUILD_logray)
+               set(LOG_EXTCAP_INSTALL_LIBDIR "extcap/${LOG_PROJECT_NAME}" CACHE INTERNAL "The Logray extcap dir")
+       endif()
 else()
-       set(EXTCAP_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/extcap" CACHE INTERNAL "The extcap dir")
+       set(EXTCAP_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/extcap" CACHE INTERNAL "The Wireshark extcap dir")
+       if (BUILD_logray)
+               set(LOG_EXTCAP_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${LOG_PROJECT_NAME}/extcap" CACHE INTERNAL "The Logray extcap dir")
+       endif()
 endif()
-set(EXTCAP_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${EXTCAP_INSTALL_LIBDIR}")
 
 if(APPLE)
        #
@@ -1700,6 +1725,7 @@ if(ENABLE_PLUGINS)
                plugins/epan/wimax
                plugins/epan/wimaxasncp
                plugins/epan/wimaxmacphy
+               plugins/epan/dfilter/ipaddr
                plugins/wiretap/usbdump
                plugins/codecs/G711
                plugins/codecs/l16_mono
@@ -1803,12 +1829,6 @@ configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h
 
 configure_file(${CMAKE_SOURCE_DIR}/ws_version.h.in ${CMAKE_BINARY_DIR}/ws_version.h)
 
-set( prefix "${CMAKE_INSTALL_PREFIX}" )
-set( exec_prefix "\${prefix}" )
-set( libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}" )
-set( includedir  "\${prefix}/include" )
-set( plugindir "\${libdir}/wireshark/${PLUGIN_VERSION_DIR}" )
-
 # Doxygen variables
 file(GLOB TOP_LEVEL_SOURCE_LIST *.c *.cpp *.h)
 string (REPLACE ";" " " DOXYGEN_TOP_LEVEL_SOURCES "${TOP_LEVEL_SOURCE_LIST}")
@@ -1828,8 +1848,8 @@ set(CFG_OUT_FILES
        resources/libwiretap.rc
        resources/libwsutil.rc
        resources/wireshark.exe.manifest
+       resources/wireshark.pc
        resources/wireshark.rc
-       wireshark.pc
 )
 
 if(BUILD_logray)
@@ -1899,7 +1919,7 @@ set_package_properties(LZ4 PROPERTIES
 set_package_properties(SNAPPY PROPERTIES
        DESCRIPTION "A fast compressor/decompressor from Google"
        URL "https://google.github.io/snappy/"
-       PURPOSE "Snappy decompression in CQL and Kafka dissectors"
+       PURPOSE "Snappy decompression in Couchbase, CQL, Kafka and Mongo dissectors"
 )
 set_package_properties(ZSTD PROPERTIES
        DESCRIPTION "A compressor/decompressor from Facebook providing better compression than Snappy at a cost of speed"
@@ -1911,6 +1931,11 @@ set_package_properties(NGHTTP2 PROPERTIES
        URL "https://nghttp2.org"
        PURPOSE "Header decompression in HTTP2"
 )
+set_package_properties(NGHTTP3 PROPERTIES
+       DESCRIPTION "HTTP/3 C library and tools"
+       URL "https://nghttp2.org"
+       PURPOSE "Header decompression in HTTP3"
+)
 set_package_properties(CARES PROPERTIES
        DESCRIPTION "Library for asynchronous DNS requests"
        URL "https://c-ares.org/"
@@ -1956,6 +1981,11 @@ set_package_properties(Sinsp PROPERTIES
        URL "https://github.com/falcosecurity/libs/"
        PURPOSE "Support for Falco plugins"
 )
+set_package_properties(Lua PROPERTIES
+       DESCRIPTION "Lua is a powerful, efficient, lightweight, embeddable scripting language"
+       URL "https://www.lua.org/"
+       PURPOSE "Lua allows writing dissectors and other extensions without a C/C++ compiler"
+)
 
 string(TOUPPER "${CMAKE_BUILD_TYPE}" _build_type)
 message(STATUS "C-Flags: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${_build_type}}")
@@ -1973,9 +2003,6 @@ if(WIN32)
        set(PLATFORM_UI_SRC
                ui/win32/file_dlg_win32.cpp
        )
-       set(PLATFORM_UI_RC_FILES
-               resources/file_dlg_win32.rc
-       )
 elseif(APPLE)
        set(PLATFORM_UI_SRC
                ui/macosx/cocoa_bridge.mm
@@ -2017,12 +2044,14 @@ set(TSHARK_TAP_SRC
        ${CMAKE_SOURCE_DIR}/ui/cli/tap-srt.c
        ${CMAKE_SOURCE_DIR}/ui/cli/tap-stats_tree.c
        ${CMAKE_SOURCE_DIR}/ui/cli/tap-sv.c
+       ${CMAKE_SOURCE_DIR}/ui/cli/tap-voip.c
        ${CMAKE_SOURCE_DIR}/ui/cli/tap-wspstat.c
        ${CUSTOM_TSHARK_TAP_SRC}
 
 )
 
-# Installed into ${DATAFILE_DIR}
+# Copied into ${DATAFILE_DIR} at build time and ${CMAKE_INSTALL_DATADIR}/wireshark
+# at install time.
 set(INSTALL_DIRS
        resources/share/wireshark/profiles
        resources/protocols/diameter
@@ -2032,26 +2061,29 @@ set(INSTALL_DIRS
        resources/protocols/wimaxasncp
 )
 
-# Installed into ${DATAFILE_DIR}
+# Copied into ${DATAFILE_DIR} at build time and ${CMAKE_INSTALL_DATADIR}/wireshark
+# at install time.
 set(INSTALL_FILES
-       enterprises.tsv
-       manuf
        resources/share/wireshark/cfilters
        resources/share/wireshark/colorfilters
-       resources/share/wireshark/dfilter_macros
+       resources/share/wireshark/dmacros
        resources/share/wireshark/dfilters
+       resources/share/wireshark/ipmap.html
        resources/share/wireshark/smi_modules
-       services
        wka
 )
+
 set(DOC_FILES
-       resources/share/doc/wireshark/ipmap.html
        resources/share/doc/wireshark/pdml2html.xsl
        doc/README.xml-output
        docbook/ws.css
 )
 
 if (BUILD_logray)
+       set(LOG_INSTALL_DIRS
+               resources/share/logray/profiles
+       )
+
        set(LOG_INSTALL_FILES
                docbook/ws.css
                resources/share/logray/colorfilters
@@ -2081,6 +2113,7 @@ if (ASCIIDOCTOR_FOUND)
                ${CMAKE_BINARY_DIR}/doc/tshark.html
                ${CMAKE_BINARY_DIR}/doc/wireshark.html
                ${CMAKE_BINARY_DIR}/doc/wireshark-filter.html
+               ${CMAKE_BINARY_DIR}/doc/release-notes.html
        )
        if(MAXMINDDB_FOUND)
                list(APPEND DOC_FILES ${CMAKE_BINARY_DIR}/doc/mmdbresolve.html)
@@ -2128,6 +2161,15 @@ if(USE_REPOSITORY)
                COMMAND_EXPAND_LISTS
        )
 
+       add_custom_command(TARGET copy_cli_dlls PRE_BUILD
+               COMMAND ${CMAKE_COMMAND} -E copy_if_different
+                       "$<IF:$<CONFIG:Debug>,${PCRE2_DEBUG_DLL},${PCRE2_RELEASE_DLL}>"
+                       "$<IF:$<CONFIG:Debug>,${PCRE2_DEBUG_PDB},${PCRE2_RELEASE_PDB}>"
+                       "${_dll_output_dir}"
+               WORKING_DIRECTORY $<IF:$<CONFIG:Debug>,${PCRE2_DEBUG_DLL_DIR},${PCRE2_RELEASE_DLL_DIR}>
+               COMMAND_EXPAND_LISTS
+       )
+
        if (MSVC AND VLD_FOUND)
                add_custom_command(TARGET copy_cli_dlls PRE_BUILD
                        COMMAND ${CMAKE_COMMAND} -E "$<IF:$<CONFIG:Debug>,copy_if_different,true>"
@@ -2172,17 +2214,18 @@ if(USE_REPOSITORY)
                list (APPEND THIRD_PARTY_DLLS "${LZ4_DLL_DIR}/${LZ4_DLL}")
                list (APPEND THIRD_PARTY_PDBS "${LZ4_DLL_DIR}/${LZ4_PDB}")
        endif(LZ4_FOUND)
-       if (ZSTD_FOUND)
-               list (APPEND THIRD_PARTY_DLLS "${ZSTD_DLL_DIR}/${ZSTD_DLL}")
-       endif(ZSTD_FOUND)
+       if (MINIZIP_FOUND)
+               list (APPEND THIRD_PARTY_DLLS "${MINIZIP_DLL_DIR}/${MINIZIP_DLL}")
+               list (APPEND THIRD_PARTY_PDBS "${MINIZIP_DLL_DIR}/${MINIZIP_PDB}")
+       endif()
        if (NGHTTP2_FOUND)
                list (APPEND THIRD_PARTY_DLLS "${NGHTTP2_DLL_DIR}/${NGHTTP2_DLL}")
                list (APPEND THIRD_PARTY_PDBS "${NGHTTP2_DLL_DIR}/${NGHTTP2_PDB}")
        endif(NGHTTP2_FOUND)
-       if (PCRE2_FOUND)
-               list (APPEND THIRD_PARTY_DLLS "${PCRE2_DLL_DIR}/${PCRE2_DLL}")
-               list (APPEND THIRD_PARTY_PDBS "${PCRE2_DLL_DIR}/${PCRE2_PDB}")
-       endif(PCRE2_FOUND)
+       if (NGHTTP3_FOUND)
+               list (APPEND THIRD_PARTY_DLLS "${NGHTTP3_DLL_DIR}/${NGHTTP3_DLL}")
+               list (APPEND THIRD_PARTY_PDBS "${NGHTTP3_DLL_DIR}/${NGHTTP3_PDB}")
+       endif(NGHTTP3_FOUND)
        if (SBC_FOUND)
                list (APPEND THIRD_PARTY_DLLS "${SBC_DLL_DIR}/${SBC_DLL}")
        endif(SBC_FOUND)
@@ -2268,6 +2311,9 @@ if(USE_REPOSITORY)
        if (SPEEXDSP_FOUND)
                list (APPEND THIRD_PARTY_DLLS "${SPEEXDSP_DLL_DIR}/${SPEEXDSP_DLL}")
        endif()
+       if (ZSTD_FOUND)
+               list (APPEND THIRD_PARTY_DLLS "${ZSTD_DLL_DIR}/${ZSTD_DLL}")
+       endif()
 
        # With libs downloaded to c:/wireshark-x64-libs this currently
        # (early 2018) expands to about 1900 characters.
@@ -2323,7 +2369,7 @@ endif()
 set(copy_data_files_depends)
 
 if(WIN32)
-       foreach(_install_as_txt_file COPYING NEWS README.md README.windows)
+       foreach(_install_as_txt_file COPYING NEWS README.md)
                # On Windows, install some files with a .txt extension so that they're
                # double-clickable.
                string(REGEX REPLACE ".md$" "" _no_md_file ${_install_as_txt_file})
@@ -2354,47 +2400,28 @@ foreach(_install_file ${INSTALL_FILES} ${DOC_FILES})
        list(APPEND copy_data_files_depends "${_output_file}")
 endforeach()
 
-if (BUILD_logray AND ENABLE_APPLICATION_BUNDLE)
-       foreach(_install_file ${LOG_INSTALL_FILES})
-               get_filename_component(_install_file_src "${_install_file}" ABSOLUTE)
-               get_filename_component(_install_basename "${_install_file}" NAME)
-               set(_output_file "${LOG_DATAFILE_DIR}/${_install_basename}")
-               add_custom_command(OUTPUT "${_output_file}"
-                       COMMAND ${CMAKE_COMMAND} -E copy_if_different
-                               "${_install_file_src}"
-                               "${_output_file}"
-                       DEPENDS
-                               docs
-                               "${_install_file}"
-               )
-               list(APPEND copy_data_files_depends "${_output_file}")
-       endforeach()
+if (BUILD_logray)
+       if (ENABLE_APPLICATION_BUNDLE)
+               foreach(_install_file ${LOG_INSTALL_FILES})
+                       get_filename_component(_install_file_src "${_install_file}" ABSOLUTE)
+                       get_filename_component(_install_basename "${_install_file}" NAME)
+                       set(_output_file "${LOG_DATAFILE_DIR}/${_install_basename}")
+                       add_custom_command(OUTPUT "${_output_file}"
+                               COMMAND ${CMAKE_COMMAND} -E copy_if_different
+                                       "${_install_file_src}"
+                                       "${_output_file}"
+                               DEPENDS
+                                       docs
+                                       "${_install_file}"
+                       )
+                       list(APPEND copy_data_files_depends "${_output_file}")
+               endforeach()
+       else()
+               # XXX The default profile (colorfilters, dfilters) is at the
+               # top-level resources directory for both Wireshark and Logray.
+       endif()
 endif()
 
-# Install Lua files in staging directory such that Lua can used when Wireshark
-# is ran from the build directory. For install targets, see
-# epan/wslua/CMakeLists.txt
-if(LUA_FOUND AND ENABLE_LUA)
-       set(_lua_files
-               "${CMAKE_SOURCE_DIR}/epan/wslua/init.lua"
-               "${CMAKE_SOURCE_DIR}/epan/wslua/console.lua"
-               "${CMAKE_SOURCE_DIR}/epan/wslua/dtd_gen.lua"
-       )
-       foreach(_lua_file ${_lua_files})
-               get_filename_component(_lua_filename "${_lua_file}" NAME)
-               list(APPEND copy_data_files_depends
-                       "${DATAFILE_DIR}/${_lua_filename}")
-               add_custom_command(OUTPUT "${DATAFILE_DIR}/${_lua_filename}"
-                       COMMAND ${CMAKE_COMMAND} -E copy_if_different
-                               "${_lua_file}"
-                               "${DATAFILE_DIR}/${_lua_filename}"
-                       DEPENDS
-                               "${_lua_file}"
-               )
-       endforeach()
-endif(LUA_FOUND AND ENABLE_LUA)
-# doc/*.html handled elsewhere.
-
 set(_protocol_data_dir ${CMAKE_SOURCE_DIR}/resources/protocols)
 # Glob patterns relative to the source directory that should be copied to
 # ${DATAFILE_DIR} (including directory prefixes)
@@ -2521,12 +2548,28 @@ add_custom_command(
                "${CMAKE_SOURCE_DIR}/resources/share/wireshark/profiles" "${DATAFILE_DIR}/profiles"
 )
 
+set (_log_profiles_data_files)
+if (BUILD_logray AND ENABLE_APPLICATION_BUNDLE)
+       set(_profiles_src_dir ${CMAKE_SOURCE_DIR}/resources/share/logray)
+       file(GLOB _profiles_src_files RELATIVE ${_profiles_src_dir} ${_profiles_src_dir}/profiles/*/*)
+       foreach(_data_file ${_profiles_src_files})
+               list(APPEND _log_profiles_data_files "${LOG_DATAFILE_DIR}/${_data_file}")
+       endforeach()
+
+       add_custom_command(
+               OUTPUT ${_log_profiles_data_files}
+               COMMAND ${CMAKE_COMMAND} -E copy_directory
+                       "${CMAKE_SOURCE_DIR}/resources/share/logray/profiles" "${LOG_DATAFILE_DIR}/profiles"
+       )
+endif()
+
 list(APPEND copy_data_files_depends
        ${_dtds_data_files}
        ${_diameter_data_files}
        ${_radius_data_files}
        ${_protobuf_data_files}
        ${_profiles_data_files}
+       ${_log_profiles_data_files}
 )
 
 # Copy files including ${INSTALL_FILES} and ${INSTALL_DIRS} to ${DATAFILE_DIR}
@@ -2759,7 +2802,7 @@ if(BUILD_wireshark AND QT_FOUND)
                        file(WRITE ${CMAKE_BINARY_DIR}/run/wireshark "#!/bin/sh\n")
                        file(APPEND ${CMAKE_BINARY_DIR}/run/wireshark "# Generated by ${CMAKE_CURRENT_LIST_FILE}\n")
                        file(APPEND ${CMAKE_BINARY_DIR}/run/wireshark "# Wrapper script which ensures that we're properly activated via Launch Services\n")
-                       file(APPEND ${CMAKE_BINARY_DIR}/run/wireshark "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/Wireshark \"\$\@\"\n")
+                       file(APPEND ${CMAKE_BINARY_DIR}/run/wireshark "exec \"${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/Wireshark\" \"\$\@\"\n")
                        execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/wireshark)
                endif()
        endif()
@@ -2870,7 +2913,7 @@ if(BUILD_logray AND QT_FOUND)
                        file(WRITE ${CMAKE_BINARY_DIR}/run/logray "#!/bin/sh\n")
                        file(APPEND ${CMAKE_BINARY_DIR}/run/logray "# Generated by ${CMAKE_CURRENT_LIST_FILE}\n")
                        file(APPEND ${CMAKE_BINARY_DIR}/run/logray "# Wrapper script which ensures that we're properly activated via Launch Services\n")
-                       file(APPEND ${CMAKE_BINARY_DIR}/run/logray "exec ${CMAKE_BINARY_DIR}/run/Logray.app/Contents/MacOS/Logray \"\$\@\"\n")
+                       file(APPEND ${CMAKE_BINARY_DIR}/run/logray "exec \"${CMAKE_BINARY_DIR}/run/Logray.app/Contents/MacOS/Logray\" \"\$\@\"\n")
                        execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/logray)
                endif()
        endif()
@@ -2885,11 +2928,11 @@ if(BUILD_logray AND QT_FOUND)
        )
 
        if(QT_WINDEPLOYQT_EXECUTABLE)
-               add_custom_target(copy_ls_qt_dlls ALL)
-               set_target_properties(copy_ls_qt_dlls PROPERTIES FOLDER "Copy Tasks")
+               add_custom_target(copy_logray_qt_dlls ALL)
+               set_target_properties(copy_logray_qt_dlls PROPERTIES FOLDER "Copy Tasks")
                # Will we ever need to use --debug? Windeployqt seems to
                # be smart enough to copy debug DLLs when needed.
-               add_custom_command(TARGET copy_ls_qt_dlls
+               add_custom_command(TARGET copy_logray_qt_dlls
                        POST_BUILD
                        COMMAND set "PATH=${QT_BIN_PATH};%PATH%"
                        COMMAND "${QT_WINDEPLOYQT_EXECUTABLE}"
@@ -2898,7 +2941,7 @@ if(BUILD_logray AND QT_FOUND)
                                $<$<BOOL:${MSVC}>:--pdb>
                                "$<TARGET_FILE:logray>"
                )
-               add_dependencies(copy_ls_qt_dlls logray)
+               add_dependencies(copy_logray_qt_dlls logray)
 
                install(CODE "execute_process(COMMAND
                        \"${QT_WINDEPLOYQT_EXECUTABLE}\"
@@ -2976,7 +3019,6 @@ if(BUILD_tshark)
                ${APPLE_CORE_FOUNDATION_LIBRARY}
                ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
                ${WIN_WS2_32_LIBRARY}
-               ${M_LIBRARIES}
        )
        set(tshark_FILES
                $<TARGET_OBJECTS:capture_opts>
@@ -3050,6 +3092,7 @@ if(BUILD_sharkd)
                ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
                ${WIN_WS2_32_LIBRARY}
                ${SPEEXDSP_LIBRARIES}
+               ${GCRYPT_LIBRARIES}
        )
        set(sharkd_FILES
                #
@@ -3057,9 +3100,11 @@ if(BUILD_sharkd)
                # $<TARGET_OBJECTS:cli_main> and has real_main().
                #
                $<TARGET_OBJECTS:shark_common>
+               ui/cli/simple_dialog.c
                sharkd.c
                sharkd_daemon.c
                sharkd_session.c
+               ${TSHARK_TAP_SRC}
        )
        set_executable_resources(sharkd "SharkD")
        add_executable(sharkd ${sharkd_FILES})
@@ -3336,7 +3381,6 @@ if(WIN32)
 
        if(MAKENSIS_EXECUTABLE)
                add_subdirectory( packaging/nsis EXCLUDE_FROM_ALL )
-               ADD_NSIS_UNINSTALLER_TARGETS()
                ADD_NSIS_PACKAGE_TARGETS()
        endif()
 
@@ -3521,7 +3565,7 @@ if(ENABLE_APPLICATION_BUNDLE AND BUILD_wireshark)
        COMMAND ${ASCIIDOCTOR_EXECUTABLE}
                --backend html
                --out-file ${_wireshark_read_me_first}
-               --attribute include-dir=${CMAKE_SOURCE_DIR}/docbook
+               --attribute include-dir=${CMAKE_SOURCE_DIR}/doc
                --attribute min-macos-version=${MIN_MACOS_VERSION}
                ${CMAKE_CURRENT_SOURCE_DIR}/packaging/macosx/Wireshark_read_me_first.adoc
        DEPENDS
@@ -3535,7 +3579,7 @@ if(ENABLE_APPLICATION_BUNDLE AND BUILD_wireshark)
        COMMAND ${ASCIIDOCTOR_EXECUTABLE}
                --backend html
                --out-file ${_wireshark_donate}
-               --attribute include-dir=${CMAKE_SOURCE_DIR}/docbook
+               --attribute include-dir=${CMAKE_SOURCE_DIR}/doc
                --attribute min-macos-version=${MIN_MACOS_VERSION}
                ${CMAKE_CURRENT_SOURCE_DIR}/packaging/macosx/Donate_to_the_Wireshark_Foundation.adoc
        DEPENDS
@@ -3549,7 +3593,7 @@ if(ENABLE_APPLICATION_BUNDLE AND BUILD_wireshark)
        COMMAND ${ASCIIDOCTOR_EXECUTABLE}
                --backend html
                --out-file ${_wireshark_dsym_installation}
-               --attribute include-dir=${CMAKE_SOURCE_DIR}/docbook
+               --attribute include-dir=${CMAKE_SOURCE_DIR}/doc
                ${CMAKE_CURRENT_SOURCE_DIR}/packaging/macosx/Wireshark_dsym_installation.adoc
        DEPENDS
                ${CMAKE_CURRENT_SOURCE_DIR}/packaging/macosx/Wireshark_dsym_installation.adoc
@@ -3589,7 +3633,7 @@ if(ENABLE_APPLICATION_BUNDLE AND BUILD_logray)
        COMMAND ${ASCIIDOCTOR_EXECUTABLE}
                --backend html
                --out-file ${_logray_read_me_first}
-               --attribute include-dir=${CMAKE_SOURCE_DIR}/docbook
+               --attribute include-dir=${CMAKE_SOURCE_DIR}/doc
                --attribute min-macos-version=${MIN_MACOS_VERSION}
                ${CMAKE_CURRENT_SOURCE_DIR}/packaging/macosx/Logray_read_me_first.adoc
        DEPENDS
@@ -3603,7 +3647,7 @@ if(ENABLE_APPLICATION_BUNDLE AND BUILD_logray)
        COMMAND ${ASCIIDOCTOR_EXECUTABLE}
                --backend html
                --out-file ${_logray_dsym_installation}
-               --attribute include-dir=${CMAKE_SOURCE_DIR}/docbook
+               --attribute include-dir=${CMAKE_SOURCE_DIR}/doc
                ${CMAKE_CURRENT_SOURCE_DIR}/packaging/macosx/Logray_dsym_installation.adoc
        DEPENDS
                ${CMAKE_CURRENT_SOURCE_DIR}/packaging/macosx/Logray_dsym_installation.adoc
@@ -3918,9 +3962,22 @@ install(
                GROUP_READ
                WORLD_READ
        DESTINATION
-               ${CMAKE_INSTALL_DATADIR}
+               ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}
 )
 
+if (BUILD_logray)
+       install(
+               FILES
+                       ${LOG_INSTALL_FILES}
+               PERMISSIONS
+                       OWNER_WRITE OWNER_READ
+                       GROUP_READ
+                       WORLD_READ
+               DESTINATION
+                       ${CMAKE_INSTALL_DATADIR}/${LOG_PROJECT_NAME}
+       )
+endif()
+
 install(
        FILES
                ${DOC_FILES}
@@ -4013,13 +4070,9 @@ if(BUILD_logray AND QT_FOUND AND NOT APPLE AND (NOT WIN32 OR USE_MSYSTEM))
                RENAME org.wireshark.Logray.svg)
 endif()
 
-install(
-       FILES
-               "${CMAKE_BINARY_DIR}/wireshark.pc"
-       DESTINATION
-               ${CMAKE_INSTALL_LIBDIR}/pkgconfig
-       COMPONENT
-               "Development"
+install(FILES "${CMAKE_BINARY_DIR}/resources/wireshark.pc"
+       DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
+       COMPONENT "Development"
        EXCLUDE_FROM_ALL
 )
 
@@ -4027,7 +4080,7 @@ install(
        DIRECTORY
                ${INSTALL_DIRS}
        DESTINATION
-               ${CMAKE_INSTALL_DATADIR}
+               ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}
        FILE_PERMISSIONS
                OWNER_WRITE OWNER_READ
                GROUP_READ
@@ -4041,12 +4094,32 @@ install(
        PATTERN "Makefile.*" EXCLUDE
 )
 
+if (BUILD_logray)
+       install(
+               DIRECTORY
+                       ${LOG_INSTALL_DIRS}
+               DESTINATION
+                       ${CMAKE_INSTALL_DATADIR}/${LOG_PROJECT_NAME}
+               FILE_PERMISSIONS
+                       OWNER_WRITE OWNER_READ
+                       GROUP_READ
+                       WORLD_READ
+               DIRECTORY_PERMISSIONS
+                       OWNER_EXECUTE OWNER_WRITE OWNER_READ
+                       GROUP_EXECUTE GROUP_READ
+                       WORLD_EXECUTE WORLD_READ
+               PATTERN ".git" EXCLUDE
+               PATTERN ".svn" EXCLUDE
+               PATTERN "Makefile.*" EXCLUDE
+       )
+endif()
+
 if(WIN32 AND NOT USE_MSYSTEM)
        # Note: CMake export mechanism misbehaves with a '.' in the
        # path (incorrect relative path computation).
        set(WIRESHARK_INSTALL_CMAKEDIR "cmake")
 else()
-       set(WIRESHARK_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/cmake")
+       set(WIRESHARK_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
 endif()
 
 include(CMakePackageConfigHelpers)
@@ -4260,6 +4333,11 @@ if(MSVC)
        endforeach()
 endif()
 
+# -----------------------------------------------------------------------------
+# Packaging (CPack)
+# -----------------------------------------------------------------------------
+include(ConfigCPack.cmake)
+
 #
 # Editor modelines  -  https://www.wireshark.org/tools/modelines.html
 #