# Download third-party libraries
file (TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/tools/win-setup.ps1 _win_setup)
file (TO_NATIVE_PATH ${_PROJECT_LIB_DIR} _ws_lib_dir)
- if(MSVC14)
- set(_vsversion_args "14")
- elseif(MSVC12)
- set(_vsversion_args "12")
- elseif(MSVC11)
- set(_vsversion_args "11")
- elseif(MSVC10)
- set(_vsversion_args "10")
- else()
- message(FATAL_ERROR "Unsupported compiler ${CMAKE_C_COMPILER}")
- endif()
# Is it possible to have a one-time, non-cached option in CMake? If
# so, we could add a "-DFORCE_WIN_SETUP" which passes -Force to
# win-setup.ps1.
execute_process(
- COMMAND ${POWERSHELL_COMMAND} "\"${_win_setup}\"" -Destination "${_ws_lib_dir}" -Platform ${WIRESHARK_TARGET_PLATFORM} -VSVersion ${_vsversion_args}
+ COMMAND ${POWERSHELL_COMMAND} "\"${_win_setup}\"" -Destination "${_ws_lib_dir}" -Platform ${WIRESHARK_TARGET_PLATFORM}
RESULT_VARIABLE _win_setup_failed
)
if(_win_setup_failed)
# Prepopulate some ConfigureChecks values. Compilation checks
# on Windows can be slow.
set(HAVE_FCNTL_H TRUE)
- set(HAVE_SYS_STAT_H TRUE)
set(HAVE_FLOORL TRUE)
set(HAVE_LRINT TRUE)
endif()
if(APPLE AND EXISTS /usr/local/opt/qt5)
- # Homebrew installs Qt5 (up to at least 5.9.1) in
- # /usr/local/qt5, ensure it can be found by CMake since
- # it is not in the default /usr/local prefix.
- list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt5")
+ # Homebrew installs Qt5 (up to at least 5.11.0) in
+ # /usr/local/qt5. Ensure that it can be found by CMake
+ # since it is not in the default /usr/local prefix.
+ # Add it to PATHS so that it doesn't override the
+ # CMAKE_PREFIX_PATH environment variable.
+ # QT_FIND_PACKAGE_OPTIONS should be passed to find_package,
+ # e.g. find_package(Qt5Core ${QT_FIND_PACKAGE_OPTIONS})
+ set (QT_FIND_PACKAGE_OPTIONS PATHS /usr/local/opt/qt5)
endif()
# Always enable position-independent code when compiling, even for
# This option only has an effect on CMake >= 2.8.9
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+# Path to our generated executables (or wrapper scripts)
+if(WIN32)
+ set(WS_PROGRAM_PATH ./run/$<CONFIG>)
+else()
+ set(WS_PROGRAM_PATH ./run)
+endif()
+
if( CMAKE_C_COMPILER_ID MATCHES "MSVC")
if ((MSVC_VERSION LESS "1900") OR (MSVC_VERSION GREATER_EQUAL "2000"))
message(FATAL_ERROR "You are using an unsupported version of MSVC")
# resolution of symbols, add Psapi.lib to the TARGETLIBS macro and compile the program
# with -DPSAPI_VERSION=1.To use run-time dynamic linking, load Psapi.dll.
# http://msdn.microsoft.com/en-us/library/windows/desktop/ms683219(v=vs.85).aspx
- # -DBUILD_WINDOWS Starting from VS2013, GetVersionEx is deprecated and we are recommended to use
- # VerifyVersionInfo instead
- # http://msdn.microsoft.com/en-us/library/windows/desktop/ms724429(v=vs.85).aspx
- # http://msdn.microsoft.com/en-us/library/windows/desktop/ms725491(v=vs.85).aspx
- # To continue to use GetVersionEx, we can define BUILD_WINDOWS
# -D_ALLOW_KEYWORD_MACROS For VS2012 onwards the, C++ STL does not permit macro redefinitions of keywords
# (see http://msdn.microsoft.com/en-us/library/bb531344(v=vs.110).aspx)
# This definition prevents the complaint about the redefinition of inline by WinPCap
# in pcap-stdinc.h when compiling C++ files, e.g. the Qt UI
/DPSAPI_VERSION=1
- /DBUILD_WINDOWS
/D_ALLOW_KEYWORD_MACROS
)
set(WS_LINK_FLAGS "/LARGEADDRESSAWARE /MANIFEST:NO /INCREMENTAL:NO /RELEASE")
- if(MSVC12)
- # /Zo Enhanced debugging of optimised code for VS2013 Update 3 and beyond,
- # Assume all VS2013 builds are at least Update 3.
- # See http://msdn.microsoft.com/en-us/library/dn785163.aspx
- list(APPEND LOCAL_CFLAGS /Zo)
- elseif(MSVC14)
- # To do: Add /external:... See https://blogs.msdn.microsoft.com/vcblog/2017/12/13/broken-warnings-theory/
- #
- # /Zo Enhanced debugging of optimised code
- # /utf-8 Set Source and Executable character sets to UTF-8
- # VS2015(MSVC14): On by default when /Zi or /Z7 used.
- # /guard:cf Control Flow Guard (compile and link).
- # See https://msdn.microsoft.com/en-us/library/windows/desktop/mt637065.aspx
- # Note: This requires CMake 3.9.0 or newer.
- # https://gitlab.kitware.com/cmake/cmake/commit/f973d49ab9d4c59b93f6dac812a94bb130200836
- # /Qspectre Speculative execution attack mitigation
- # See https://blogs.msdn.microsoft.com/vcblog/2018/01/15/spectre-mitigations-in-msvc/
- list(APPEND LOCAL_CFLAGS /Zo /utf-8 /guard:cf)
- set(WS_LINK_FLAGS "${WS_LINK_FLAGS} /guard:cf")
- # /Qspectre is not available for VS2015 or older VS2017. Test for its availability.
- set(WIRESHARK_COMMON_FLAGS /Qspectre)
- endif()
+ # To do: Add /external:... See https://blogs.msdn.microsoft.com/vcblog/2017/12/13/broken-warnings-theory/
+ #
+ # /Zo Enhanced debugging of optimised code
+ # /utf-8 Set Source and Executable character sets to UTF-8
+ # VS2015(MSVC14): On by default when /Zi or /Z7 used.
+ # /guard:cf Control Flow Guard (compile and link).
+ # See https://msdn.microsoft.com/en-us/library/windows/desktop/mt637065.aspx
+ # Note: This requires CMake 3.9.0 or newer.
+ # https://gitlab.kitware.com/cmake/cmake/commit/f973d49ab9d4c59b93f6dac812a94bb130200836
+ # /Qspectre Speculative execution attack mitigation
+ # See https://blogs.msdn.microsoft.com/vcblog/2018/01/15/spectre-mitigations-in-msvc/
+ list(APPEND LOCAL_CFLAGS /Zo /utf-8 /guard:cf)
+ set(WS_LINK_FLAGS "${WS_LINK_FLAGS} /guard:cf")
+ # /Qspectre is not available for VS2015 or older VS2017. Test for its availability.
+ set(WIRESHARK_COMMON_FLAGS /Qspectre)
if(ENABLE_CODE_ANALYSIS)
list(APPEND LOCAL_CFLAGS /analyze:WX-)
)
endif()
- set(COMMON_WARN_FLAGS
+ list(APPEND WIRESHARK_COMMON_FLAGS
# The following are for C and C++
# -O<X> and -g get set by the CMAKE_BUILD_TYPE
-Wall
-Wextra
+ -Wextra-semi
-Wendif-labels
-Wpointer-arith
-Wformat-security
-Wno-overlength-strings
-Wno-long-long
-Wheader-guard
+ -Wcomma
+ -Wshorten-64-to-32
)
#
# the stack usage - we only care about stack
# usage in normal operation.
#
- set(COMMON_WARN_FLAGS ${COMMON_WARN_FLAGS}
- -Wframe-larger-than=16384
+ set(WIRESHARK_COMMON_FLAGS ${WIRESHARK_COMMON_FLAGS}
+ -Wframe-larger-than=32768
)
endif()
- set(C_WARN_FLAGS
+ list(APPEND WIRESHARK_C_ONLY_FLAGS
# The following are C only, not C++
-Wc++-compat
-Wunused-const-variable
-Wlogical-op
-Wjump-misses-init
#
- # The Qt headers generate a ton of shortening warnings
- # on 64-bit systems, so we only enable this for C for
- # now.
- #
- -Wshorten-64-to-32
- #
# Implicit function declarations are an error in C++ and most
# likely a programming error in C. Turn -Wimplicit-int and
# -Wimplicit-function-declaration into an error by default.
#
-Werror=implicit
- #
- # The Qt headers in version 5.10 introduced a lot of
- # "Possible misuse of comma operator here" warnings.
- #
- -Wcomma
)
- set(CXX_WARN_FLAGS
+ list(APPEND WIRESHARK_CXX_ONLY_FLAGS
)
- find_package(Qt5Core) # Needed to check for Qt version
- if (Qt5Core_VERSION VERSION_GREATER 5.8)
- # The Qt headers in version 5.8 and older generate a ton of shortening
- # errors on 64-bit systems so only enable this for version 5.9 and greater.
- set(CXX_WARN_FLAGS ${CXX_WARN_FLAGS}
- -Wshorten-64-to-32
- )
- endif()
- if (Qt5Core_VERSION VERSION_LESS 5.10)
- # The Qt headers in version 5.10 introduced a lot of
- # "Possible misuse of comma operator here" warnings.
- set(CXX_WARN_FLAGS ${CXX_WARN_FLAGS}
- -Wcomma
- )
- endif()
-
#
# These are not enabled by default, because the warnings they
# produce are very hard or impossible to eliminate.
#
- set(COMMON_EXTRA_WARN_FLAGS
- # The following are for C and C++
- -Wpedantic
- #
- # As we use variadic macros, we don't want warnings
- # about them, even with -Wpedantic.
- #
- -Wno-variadic-macros
- #
- # Various code blocks this one.
- #
- -Woverflow
- -fstrict-overflow -Wstrict-overflow=4
- #
- # Due to various places where APIs we don't control
- # require us to cast away constness, we can probably
- # never enable this one with -Werror.
- #
- -Wcast-qual
- #
- # Some generated ASN.1 dissectors block this one;
- # multiple function declarations for the same
- # function are being generated.
- #
- -Wredundant-decls
- #
- # Some loops are safe, but it's hard to convince the
- # compiler of that.
- #
- -Wunsafe-loop-optimizations
- #
- # All the registration functions block these for now.
- #
- -Wmissing-prototypes
- -Wmissing-declarations
- #
- # A bunch of "that might not work on SPARC" code blocks
- # this one for now; some of it is code that *will* work
- # on SPARC, such as casts of "struct sockaddr *" to
- # "struct sockaddr_in *", which are required by some
- # APIs such as getifaddrs().
- #
- -Wcast-align
- #
- # Works only with Clang
- #
- -Wunreachable-code
- #
- # Works only with Clang but generates a lot of warnings
- # (about glib library not using Doxygen)
- #
- -Wdocumentation
- #
- # Works only with GCC 7
- #
- -Wduplicated-branches
- #
- # No longer supported by El Capitan clang on C++
- # XXX - is this one of those where CMake's check
- # doesn't fail, so it won't reject this?
- #
- -fno-delete-null-pointer-checks
- )
-
- set(C_EXTRA_WARN_FLAGS
- # The following are C only, not C++
- #
- # Due to various places where APIs we don't control
- # require us to cast away constness, we can probably
- # never enable this one with -Werror.
- #
- -Wbad-function-cast
- )
+ if(ENABLE_EXTRA_COMPILER_WARNINGS) # This overrides -Werror
+ list(APPEND WIRESHARK_COMMON_FLAGS
+ # The following are for C and C++
+ -Wpedantic
+ #
+ # As we use variadic macros, we don't want warnings
+ # about them, even with -Wpedantic.
+ #
+ -Wno-variadic-macros
+ #
+ # Various code blocks this one.
+ #
+ -Woverflow
+ -fstrict-overflow -Wstrict-overflow=4
+ #
+ # Due to various places where APIs we don't control
+ # require us to cast away constness, we can probably
+ # never enable this one with -Werror.
+ #
+ -Wcast-qual
+ #
+ # Some generated ASN.1 dissectors block this one;
+ # multiple function declarations for the same
+ # function are being generated.
+ #
+ -Wredundant-decls
+ #
+ # Some loops are safe, but it's hard to convince the
+ # compiler of that.
+ #
+ -Wunsafe-loop-optimizations
+ #
+ # All the registration functions block these for now.
+ #
+ -Wmissing-prototypes
+ -Wmissing-declarations
+ #
+ # A bunch of "that might not work on SPARC" code blocks
+ # this one for now; some of it is code that *will* work
+ # on SPARC, such as casts of "struct sockaddr *" to
+ # "struct sockaddr_in *", which are required by some
+ # APIs such as getifaddrs().
+ #
+ -Wcast-align
+ #
+ # Works only with Clang
+ #
+ -Wunreachable-code
+ #
+ # Works only with Clang but generates a lot of warnings
+ # (about glib library not using Doxygen)
+ #
+ -Wdocumentation
+ #
+ # Works only with GCC 7
+ #
+ -Wduplicated-branches
+ #
+ # No longer supported by El Capitan clang on C++
+ # XXX - is this one of those where CMake's check
+ # doesn't fail, so it won't reject this?
+ #
+ -fno-delete-null-pointer-checks
+ )
- set(CXX_EXTRA_WARN_FLAGS
- )
+ list(APPEND WIRESHARK_C_ONLY_FLAGS
+ # The following are C only, not C++
+ #
+ # Due to various places where APIs we don't control
+ # require us to cast away constness, we can probably
+ # never enable this one with -Werror.
+ #
+ -Wbad-function-cast
+ )
- if(ENABLE_EXTRA_COMPILER_WARNINGS) # This overrides -Werror
- set(COMMON_WARN_FLAGS ${COMMON_WARN_FLAGS} ${COMMON_EXTRA_WARN_FLAGS})
- set(C_WARN_FLAGS ${C_WARN_FLAGS} ${C_EXTRA_WARN_FLAGS})
- set(CXX_WARN_FLAGS ${CXX_WARN_FLAGS} ${CXX_EXTRA_WARN_FLAGS})
+ list(APPEND WIRESHARK_CXX_ONLY_FLAGS
+ )
endif()
add_definitions(
)
set(WIRESHARK_LD_FLAGS
+ # See also CheckCLinkerFlag.cmake
-Wl,--as-needed
# -flto
# -fwhopr
# -fwhole-program
+ # XXX: This is applicable only when linking executables.
+ -pie
)
- # CMAKE_POSITION_INDEPENDENT_CODE is only supported starting with CMake
- # 2.8.9. Do not add -pie automatically for older versions.
- #
- # XXX - are there other compilers that don't support -pie? It's
- # not as if the only platforms we support are Windows and Linux....
- #
- if(NOT CMAKE_VERSION VERSION_LESS "2.8.9")
- set(WIRESHARK_LD_FLAGS ${WIRESHARK_LD_FLAGS}
- -pie
- )
- endif()
endif() # ! MSVC
-set( C_FLAG_TESTS ${WIRESHARK_COMMON_FLAGS} ${WIRESHARK_C_ONLY_FLAGS} )
-set( CXX_FLAG_TESTS ${WIRESHARK_COMMON_FLAGS} ${WIRESHARK_CXX_ONLY_FLAGS} )
-
-set( C_WARN_TESTS ${COMMON_WARN_FLAGS} ${C_WARN_FLAGS} )
-set( CXX_WARN_TESTS ${COMMON_WARN_FLAGS} ${CXX_WARN_FLAGS} )
-
# Counterhack to work around some cache magic in CHECK_C_SOURCE_COMPILES
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
set(BUILD_SHARED_LIBS 1)
endif()
-# Sigh: Have to use THIS_FLAG instead of ${F} for some reason
-foreach(THIS_FLAG ${C_FLAG_TESTS})
- string( REGEX REPLACE "[^a-zA-Z0-9_]+" "_" F ${THIS_FLAG} )
- set(${F} ${THIS_FLAG})
- set(V C_${F}_VALID)
- message(STATUS "Checking for c-compiler flag: ${THIS_FLAG}")
- check_c_compiler_flag("${ADDED_CMAKE_C_FLAGS} ${${F}}" ${V})
- if (${${V}})
- set(ADDED_CMAKE_C_FLAGS "${ADDED_CMAKE_C_FLAGS} ${${F}}")
+function(test_compiler_flag _lang _this_flag _valid_flags_var)
+ string(MAKE_C_IDENTIFIER "${_lang}${_this_flag}_VALID" _flag_var)
+ set(_test_flags "${${_valid_flags_var}} ${_this_flag}")
+ if(_lang STREQUAL "C")
+ check_c_compiler_flag("${_test_flags}" ${_flag_var})
+ elseif(_lang STREQUAL "CXX")
+ check_cxx_compiler_flag("${_test_flags}" ${_flag_var})
+ else()
+ message(FATAL_ERROR "Language must be C or CXX")
endif()
-endforeach()
-set(CMAKE_C_FLAGS "${ADDED_CMAKE_C_FLAGS} ${CMAKE_C_FLAGS}")
-
-foreach(THIS_FLAG ${CXX_FLAG_TESTS})
- string( REGEX REPLACE "[^a-zA-Z0-9_]+" "_" F ${THIS_FLAG} )
- set(${F} ${THIS_FLAG})
- set(V CXX_${F}_VALID)
- message(STATUS "Checking for c++-compiler flag: ${THIS_FLAG}")
- check_cxx_compiler_flag("${ADDED_CMAKE_CXX_FLAGS} ${${F}}" ${V})
- if (${${V}})
- set(ADDED_CMAKE_CXX_FLAGS "${ADDED_CMAKE_CXX_FLAGS} ${${F}}")
+ if (${_flag_var})
+ set(${_valid_flags_var} "${_test_flags}" PARENT_SCOPE)
endif()
-endforeach()
-set(CMAKE_CXX_FLAGS "${ADDED_CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+endfunction()
-foreach(THIS_FLAG ${C_WARN_TESTS})
- string( REGEX REPLACE "[^a-zA-Z0-9_]+" "_" F ${THIS_FLAG} )
- set(${F} ${THIS_FLAG})
- set(V C_${F}_VALID)
- message(STATUS "Checking for c-compiler flag: ${THIS_FLAG}")
- check_c_compiler_flag("${C_FLAG_TESTS} ${${F}}" ${V})
- if (${${V}})
- set(ADDED_WARN_C_FLAGS "${ADDED_WARN_C_FLAGS} ${${F}}")
- endif()
+foreach(THIS_FLAG ${WIRESHARK_COMMON_FLAGS} ${WIRESHARK_C_ONLY_FLAGS})
+ test_compiler_flag(C ${THIS_FLAG} ADDED_CMAKE_C_FLAGS)
endforeach()
-set(CMAKE_C_FLAGS "${ADDED_WARN_C_FLAGS} ${CMAKE_C_FLAGS}")
+set(CMAKE_C_FLAGS "${ADDED_CMAKE_C_FLAGS} ${CMAKE_C_FLAGS}")
-foreach(THIS_FLAG ${CXX_WARN_TESTS})
- string( REGEX REPLACE "[^a-zA-Z0-9_]+" "_" F ${THIS_FLAG} )
- set(${F} ${THIS_FLAG})
- set(V CXX_${F}_VALID)
- message(STATUS "Checking for c++-compiler flag: ${THIS_FLAG}")
- check_cxx_compiler_flag("${CXX_FLAG_TESTS} ${${F}}" ${V})
- if (${${V}})
- set(ADDED_WARN_CXX_FLAGS "${ADDED_WARN_CXX_FLAGS} ${${F}}")
- endif()
+foreach(THIS_FLAG ${WIRESHARK_COMMON_FLAGS} ${WIRESHARK_CXX_ONLY_FLAGS})
+ test_compiler_flag(CXX ${THIS_FLAG} ADDED_CMAKE_CXX_FLAGS)
endforeach()
-set(CMAKE_CXX_FLAGS "${ADDED_WARN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+set(CMAKE_CXX_FLAGS "${ADDED_CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
include(CMakePushCheckState)
endif()
set(WERROR_COMMON_FLAGS "")
-set(NO_ERROR_DEPRECATED_DECLARATIONS_COMPILE_FLAGS "")
if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_COMPILER_WARNINGS)
if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
set(WERROR_COMMON_FLAGS "/WX")
else()
- check_c_compiler_flag(-Werror WERROR)
- if (WERROR)
- set(WERROR_COMMON_FLAGS "-Werror")
- set(NO_ERROR_DEPRECATED_DECLARATIONS_COMPILE_FLAGS "-Wno-error=deprecated-declarations")
+ #
+ # If a warning has been enabled by -Wall or -W,
+ # and have specified -Werror, there appears to be
+ # no way, in Apple's llvm-gcc, to prevent that
+ # particular warning from giving an error - not
+ # with a pragma, not with -Wno-{warning}, and not
+ # with -Wno-error={warning}.
+ #
+ # Therefore, with that compiler, we just disable
+ # -Werror.
+ #
+ if ((NOT APPLE) OR CMAKE_C_COMPILER_ID MATCHES "Clang")
+ check_c_compiler_flag(-Werror WERROR)
+ if (WERROR)
+ set(WERROR_COMMON_FLAGS "-Werror")
+ endif()
endif()
endif()
endif()
endif()
include(CheckCLinkerFlag)
-set(_C 0)
-# Sigh: Have to use THIS_FLAG instead of ${F} for some reason
+
foreach(THIS_FLAG ${WIRESHARK_LD_FLAGS})
- set(F WS_LD_FLAG_${_C})
- set(${F} ${THIS_FLAG})
- set(V WS_LD_FLAG_VALID${_C})
- check_c_linker_flag(${${F}} ${V})
- if (${${V}})
- set(WS_LINK_FLAGS "${WS_LINK_FLAGS} ${${F}}")
- endif()
- math(EXPR _C "${_C} + 1")
+ string(MAKE_C_IDENTIFIER "LINK${THIS_FLAG}_VALID" _flag_var)
+ check_c_linker_flag(${THIS_FLAG} ${_flag_var})
+ if (${_flag_var})
+ set(WS_LINK_FLAGS "${WS_LINK_FLAGS} ${THIS_FLAG}")
+ endif()
endforeach()
+message(STATUS "Linker flags: ${WS_LINK_FLAGS}")
if(APPLE AND EXISTS /usr/local/opt/gettext)
# GLib on macOS requires libintl. Homebrew installs gettext (and
set(GLIB2_MIN_VERSION 2.32.0)
set(GTHREAD2_OPTIONS REQUIRED)
set(GCRYPT_OPTIONS "1.4.2" REQUIRED)
+set(Perl_OPTIONS REQUIRED)
set(PythonInterp_FIND_VERSION 2)
set(Python_ADDITIONAL_VERSIONS 3)
set(YACC_OPTIONS REQUIRED)
set( QT5_BASE_PATH "$ENV{QT5_BASE_DIR}" )
set( CMAKE_PREFIX_PATH "${QT5_BASE_PATH}" )
endif()
+ list (INSERT QT_FIND_PACKAGE_OPTIONS 0 REQUIRED)
set(PACKAGELIST ${PACKAGELIST}
Qt5Core
Qt5LinguistTools
Qt5Svg
Qt5Widgets
)
- set(Qt5Core_OPTIONS REQUIRED)
- set(Qt5LinguistTools_OPTIONS REQUIRED)
- set(Qt5Multimedia_OPTIONS REQUIRED)
- set(Qt5PrintSupport_OPTIONS REQUIRED)
- set(Qt5Svg_OPTIONS REQUIRED)
- set(Qt5Widgets_OPTIONS REQUIRED)
+ set(Qt5Core_OPTIONS ${QT_FIND_PACKAGE_OPTIONS})
+ set(Qt5LinguistTools_OPTIONS ${QT_FIND_PACKAGE_OPTIONS})
+ set(Qt5Multimedia_OPTIONS ${QT_FIND_PACKAGE_OPTIONS})
+ set(Qt5PrintSupport_OPTIONS ${QT_FIND_PACKAGE_OPTIONS})
+ set(Qt5Svg_OPTIONS ${QT_FIND_PACKAGE_OPTIONS})
+ set(Qt5Widgets_OPTIONS ${QT_FIND_PACKAGE_OPTIONS})
if (APPLE)
set(PACKAGELIST ${PACKAGELIST} Qt5MacExtras)
- set(Qt5MacExtras_OPTIONS REQUIRED)
+ set(Qt5MacExtras_OPTIONS ${QT_FIND_PACKAGE_OPTIONS})
endif()
if( WIN32 )
set(PACKAGELIST ${PACKAGELIST} Qt5WinExtras)
- set(Qt5WinExtras_OPTIONS REQUIRED)
+ set(Qt5WinExtras_OPTIONS ${QT_FIND_PACKAGE_OPTIONS})
endif()
endif()
# Embedded Lua interpreter
if(ENABLE_LUA)
set(PACKAGELIST ${PACKAGELIST} LUA)
+ set(LUA_OPTIONS "5.1")
endif()
if(ENABLE_NETLINK)
# 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)
# Squelch moc verbose "nothing to do" output
set(MOC_OPTIONS -nn)
endif()
+
+ # CMake uses qmake to find Qt4. It relies on Qt's CMake modules
+ # to find Qt5. This means that we can't assume that the qmake
+ # in our PATH is the correct one. We can fetch qmake's location
+ # from Qt5::qmake, which is is defined in Qt5CoreConfigExtras.cmake.
+ get_target_property(QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
+ get_filename_component(_qt_bin_path "${QT_QMAKE_EXECUTABLE}" DIRECTORY)
+ set(QT_BIN_PATH "${_qt_bin_path}" CACHE INTERNAL
+ "Path to qmake, macdeployqt, windeployqt, and other Qt utilities."
+ )
+ # Use qmake to find windeployqt and macdeployqt. Ideally one of
+ # the modules in ${QTDIR}/lib/cmake would do this for us.
+ if(WIN32)
+ find_program(QT_WINDEPLOYQT_EXECUTABLE windeployqt
+ HINTS "${QT_BIN_PATH}"
+ DOC "Path to the windeployqt utility."
+ )
+ elseif(APPLE)
+ find_program(QT_MACDEPLOYQT_EXECUTABLE macdeployqt
+ HINTS "${QT_BIN_PATH}"
+ DOC "Path to the macdeployqt utility."
+ )
+ endif()
+
endif()
if(ENABLE_CHECKHF_CONFLICT)
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_INSTALL_LIBDIR "extcap" CACHE INTERNAL "The extcap dir")
+else ()
+ set(EXTCAP_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/extcap" CACHE INTERNAL "The extcap dir")
+endif()
+
+# Directory where plugins and Lua dissectors can be found.
+if(WIN32)
+ set(PLUGIN_INSTALL_LIBDIR "plugins" CACHE INTERNAL "The plugin dir")
+else()
+ set(PLUGIN_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins" CACHE INTERNAL "The plugin dir")
+endif()
+set(PLUGIN_INSTALL_VERSION_LIBDIR "${PLUGIN_INSTALL_LIBDIR}/${PROJECT_RELEASE_VERSION}")
+set(PLUGIN_VERSION_DIR "plugins/${PROJECT_RELEASE_VERSION}")
+
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 )
# application bundle, and on UNIX in general if
# WIRESHARK_RUN_FROM_BUILD_DIRECTORY is set.
if(ENABLE_APPLICATION_BUNDLE)
- set(_datafile_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Resources/share/wireshark")
+ if(CMAKE_CFG_INTDIR STREQUAL ".")
+ set(_datafile_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Resources/share/wireshark")
+ else()
+ # Xcode
+ set(_datafile_dir "${CMAKE_BINARY_DIR}/run/${CMAKE_CFG_INTDIR}/Wireshark.app/Contents/Resources/share/wireshark")
+ endif()
elseif(NOT CMAKE_CFG_INTDIR STREQUAL ".")
# Visual Studio, Xcode, etc.
set(_datafile_dir "${CMAKE_BINARY_DIR}/run/${CMAKE_CFG_INTDIR}")
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}")
-# Used by the WiresharkConfig.cmake.in module
-if (WIN32)
- set(PLUGIN_INSTALL_DIR "${PLUGIN_VERSION_DIR}")
-else ()
- set(PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${PLUGIN_INSTALL_LIBDIR}")
-endif()
-
# Location of our plugins. PLUGIN_DIR should allow running
# from the build directory similar to DATAFILE_DIR above.
if(ENABLE_PLUGINS)
# Target platform locations
# UN*X in general, including macOS if not building an app bundle:
# $DESTDIR/lib/wireshark/plugins/$VERSION
- # Windows: $DESTDIR/wireshark/plubins/$VERSION
+ # Windows: $DESTDIR/wireshark/plugins/$VERSION
# macOS app bundle: Wireshark.app/Contents/PlugIns/wireshark
set(HAVE_PLUGINS 1)
add_custom_target(plugins)
endif()
if(ENABLE_APPLICATION_BUNDLE)
- set(_plugin_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/PlugIns/wireshark/${PROJECT_RELEASE_VERSION}")
+ if(CMAKE_CFG_INTDIR STREQUAL ".")
+ set(_plugin_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/PlugIns/wireshark/${PROJECT_RELEASE_VERSION}")
+ else()
+ # Xcode
+ set(_plugin_dir "${CMAKE_BINARY_DIR}/run/$<CONFIG>/Wireshark.app/Contents/PlugIns/wireshark/${PROJECT_RELEASE_VERSION}")
+ endif()
+elseif(WIN32 AND NOT CMAKE_CFG_INTDIR STREQUAL ".")
+ set(_plugin_dir "${CMAKE_BINARY_DIR}/run/$<CONFIG>/${PLUGIN_VERSION_DIR}")
else()
set(_plugin_dir "${DATAFILE_DIR}/${PLUGIN_VERSION_DIR}")
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")
set( configure_input "Built with CMake ${CMAKE_VERSION}" )
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(TSHARK_TAP_SRC
${CMAKE_SOURCE_DIR}/ui/cli/tap-camelsrt.c
- ${CMAKE_SOURCE_DIR}/ui/cli/tap-comparestat.c
${CMAKE_SOURCE_DIR}/ui/cli/tap-diameter-avp.c
${CMAKE_SOURCE_DIR}/ui/cli/tap-expert.c
${CMAKE_SOURCE_DIR}/ui/cli/tap-exportobject.c
)
endif(OPTIONAL_DLLS)
- # This might not be needed since make-dissectors has the same dependency.
add_dependencies(epan copy_cli_dlls)
# We have a lot of choices for creating zip archives:
DOC "Path to the 7z utility."
)
if(ZIP_EXECUTABLE)
- add_custom_target(pdb_zip_package)
+ add_custom_target(pdb_zip_package COMMENT "This packages .PDBs but will not create them.")
set_target_properties(pdb_zip_package PROPERTIES FOLDER "Packaging")
set(_pdb_zip "${CMAKE_BINARY_DIR}/Wireshark-pdb-${WIRESHARK_TARGET_PLATFORM}-${VERSION}.zip")
file(TO_NATIVE_PATH "${_pdb_zip}" _pdb_zip_win)
${PLUGIN_VERSION_DIR}/wiretap/*.pdb
WORKING_DIRECTORY "${_dll_output_dir}"
)
- add_dependencies(pdb_zip_package epan)
endif()
endif(WIN32)
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
list(APPEND copy_data_files_depends "${DATAFILE_DIR}/${_data_file}")
endforeach()
-add_custom_command(
- OUTPUT "${DATAFILE_DIR}/dtds" "${DATAFILE_DIR}/diameter" "${DATAFILE_DIR}/radius"
- COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/dtds"
- COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/diameter"
- COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/radius"
-)
-
file(GLOB _dtds_src_files RELATIVE "${CMAKE_SOURCE_DIR}" "dtds/*.dtd")
set (_dtds_data_files)
add_custom_command(
OUTPUT ${_dtds_data_files}
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/dtds"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${_dtds_src_files}
"${DATAFILE_DIR}/dtds"
VERBATIM
- DEPENDS "${DATAFILE_DIR}/dtds"
+ DEPENDS ${_dtds_src_files}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
add_custom_command(
OUTPUT ${_diameter_data_files}
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/diameter"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${_diameter_src_files}
"${DATAFILE_DIR}/diameter"
VERBATIM
- DEPENDS "${DATAFILE_DIR}/diameter"
+ DEPENDS ${_diameter_src_files}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
add_custom_command(
OUTPUT ${_radius_data_files}
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/radius"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${_radius_src_files}
"${DATAFILE_DIR}/radius"
VERBATIM
- DEPENDS "${DATAFILE_DIR}/radius"
+ DEPENDS ${_radius_src_files}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
ui
capchild
caputils
+ wiretap
${QT_LIBRARIES}
${GTHREAD2_LIBRARIES}
wscodecs
${WIN_VERSION_LIBRARY}
)
- add_executable(wireshark WIN32 MACOSX_BUNDLE wireshark-qt.cpp ${wireshark_FILES} ${EXTRA_BUNDLE_FILES})
+ add_executable(wireshark WIN32 MACOSX_BUNDLE ${wireshark_FILES} ${EXTRA_BUNDLE_FILES})
add_dependencies(wireshark version)
set(PROGLIST ${PROGLIST} wireshark)
if(CMAKE_VERSION VERSION_LESS "2.8.12"
wireshark PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_BINARY_DIR}/packaging/macosx/Info.plist
)
- # Add a wrapper script which opens the bundle. This adds
- # convenience but makes debugging more difficult.
- file(REMOVE ${CMAKE_BINARY_DIR}/run/wireshark)
- 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 "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/Wireshark \"\$\@\"\n")
- execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/wireshark)
+ if(CMAKE_CFG_INTDIR STREQUAL ".")
+ # Add a wrapper script which opens the bundle. This adds
+ # convenience but makes debugging more difficult.
+ # It is not created if using Xcode
+ file(REMOVE ${CMAKE_BINARY_DIR}/run/wireshark)
+ 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 "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/Wireshark \"\$\@\"\n")
+ execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/wireshark)
+ endif()
endif()
target_link_libraries(wireshark ${wireshark_LIBS})
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
)
- if(WIN32 AND Qt5Core_FOUND)
- # Use windeployqt to copy our required DLLs to the run path.
- # Ideally one of the modules in ${QTDIR}/lib/cmake would expose
- # the path to windeployqt. For that matter having a reliable
- # path to qmake would be *amazingly convenient*. We don't have
- # either of those so we try to discover the path via Qt5Core.
- # http://stackoverflow.com/questions/24650936/qt5-with-cmake-how-to-find-qt-translations-dir
-
- get_target_property(_qmake_location Qt5::qmake IMPORTED_LOCATION)
- get_filename_component(_qt_bin_path "${_qmake_location}" DIRECTORY)
- find_program(QT_WINDEPLOYQT_EXECUTABLE windeployqt
- HINTS "${_qmake_location}"
- DOC "Path to the windeployqt utility."
+ if(QT_WINDEPLOYQT_EXECUTABLE)
+ add_custom_target(copy_qt_dlls ALL)
+ set_target_properties(copy_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_qt_dlls
+ POST_BUILD
+ COMMAND set "PATH=${QT_BIN_PATH};%PATH%"
+ COMMAND "${QT_WINDEPLOYQT_EXECUTABLE}"
+ $<$<CONFIG:Debug>:--debug>
+ $<$<NOT:$<CONFIG:Debug>>:--release>
+ --no-compiler-runtime
+ --verbose 10
+ "$<TARGET_FILE:wireshark>"
)
- if(QT_WINDEPLOYQT_EXECUTABLE)
- set(QT_BIN_PATH "${_qt_bin_path}" CACHE INTERNAL
- "Path to qmake, windeployqt, and other Qt utilities."
- )
- add_custom_target(copy_qt_dlls ALL)
- set_target_properties(copy_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_qt_dlls
- POST_BUILD
- COMMAND set "PATH=${QT_BIN_PATH};%PATH%"
- COMMAND "${QT_WINDEPLOYQT_EXECUTABLE}"
- $<$<CONFIG:Debug>:--debug>
- $<$<NOT:$<CONFIG:Debug>>:--release>
- --no-compiler-runtime
- --verbose 10
- "$<TARGET_FILE:wireshark>"
- )
- add_dependencies(copy_qt_dlls wireshark)
- endif()
- endif(WIN32 AND Qt5Core_FOUND)
+ add_dependencies(copy_qt_dlls wireshark)
+ endif(QT_WINDEPLOYQT_EXECUTABLE)
endif()
# Common properties for CLI executables
set(PROGLIST ${PROGLIST} ${_executable})
if(ENABLE_APPLICATION_BUNDLE)
- set_target_properties(${_executable} PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY run/Wireshark.app/Contents/MacOS
- )
- # 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/${_executable} \"\$\@\"\n")
- execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/${_executable})
- 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)
+ if(NOT CMAKE_CFG_INTDIR STREQUAL ".")
+ # Xcode
+ set_target_properties(${_executable} PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY run/$<CONFIG>/Wireshark.app/Contents/MacOS
+ )
+ else ()
set_target_properties(${_executable} PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY run/Wireshark.app/Contents/MacOS/extcap
+ RUNTIME_OUTPUT_DIRECTORY run/Wireshark.app/Contents/MacOS
)
# 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")
+ file(APPEND ${CMAKE_BINARY_DIR}/run/${_executable} "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/${_executable} \"\$\@\"\n")
execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/${_executable})
endif()
endif()
ui
capchild
caputils
+ wiretap
${LIBEPAN_LIBS}
${APPLE_CORE_FOUNDATION_LIBRARY}
${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
if(BUILD_tfshark)
set(tfshark_LIBS
ui
+ wiretap
${LIBEPAN_LIBS}
${APPLE_CORE_FOUNDATION_LIBRARY}
${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
set(rawshark_LIBS
caputils
ui
+ wiretap
${LIBEPAN_LIBS}
${APPLE_CORE_FOUNDATION_LIBRARY}
${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
set(sharkd_LIBS
ui
wscodecs
+ wiretap
${LIBEPAN_LIBS}
${APPLE_CORE_FOUNDATION_LIBRARY}
${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
if(BUILD_dftest)
set(dftest_LIBS
ui
+ wiretap
${LIBEPAN_LIBS}
)
set(dftest_FILES
if(BUILD_fuzzshark)
set(fuzzshark_LIBS
+ wiretap
${LIBEPAN_LIBS}
)
set(fuzzshark_FILES
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
+ if(ENABLE_DUMPCAP_GROUP)
+ install(CODE "execute_process(COMMAND chgrp ${DUMPCAP_INSTALL_GROUP} ${CMAKE_INSTALL_FULL_BINDIR}/dumpcap)")
+ install(CODE "execute_process(COMMAND chmod o-x ${CMAKE_INSTALL_FULL_BINDIR}/dumpcap)")
+ endif()
if(DUMPCAP_INSTALL_OPTION STREQUAL "capabilities")
install( CODE "execute_process(
COMMAND
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.
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/packaging/macosx/ChmodBPF
${CMAKE_BINARY_DIR}/run/ChmodBPF
- COMMAND ${CMAKE_COMMAND} -E copy_directory
- ${CMAKE_SOURCE_DIR}/packaging/macosx/Resources
- ${CMAKE_BINARY_DIR}/run/Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/packaging/macosx/Scripts
${CMAKE_BINARY_DIR}/run/Scripts
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_program(RPMBUILD_EXECUTABLE rpmbuild)
+ find_program(DPKG_BUILDPACKAGE_EXECUTABLE dpkg-buildpackage)
find_program(GIT_EXECUTABLE git)
endif()
execute_process(
COMMAND ${PERL_EXECUTABLE}
${CMAKE_SOURCE_DIR}/make-version.pl
- --set-vcs ${GIT_BIN_PARAM}
${CMAKE_SOURCE_DIR}
)
# XXX Replace with the "dist" target?
set(_export_tarball "${CPACK_PACKAGE_NAME}-${_git_description}.tar.xz")
- MESSAGE(STATUS "set(_export_tarball: ${_export_tarball}")
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/packaging/rpm/SOURCES/${_export_tarball}"
COMMAND ./tools/git-export-release.sh
)
endif()
+if(DPKG_BUILDPACKAGE_EXECUTABLE)
+ add_custom_target(deb-package
+ COMMAND ${DPKG_BUILDPACKAGE_EXECUTABLE} -us -uc
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ )
+endif()
+
set(CLEAN_C_FILES
+ ${dumpcap_FILES}
${wireshark_FILES}
${tshark_FILES}
${rawshark_FILES}
${captype_FILES}
${editcap_FILES}
${idl2wrs_FILES}
- ${dumpcap_FILES}
- ${androiddump_FILES}
- ${sshdump_FILES}
- ${ciscodump_FILES}
${mmdbresolve_FILES}
)
ws_diag_control.h
ws_symbol_export.h
version_info.h
+ ${CMAKE_BINARY_DIR}/ws_version.h
)
if(NOT WIN32)
PATTERN "Makefile.*" EXCLUDE
)
-set(CMAKE_INSTALL_MODULES_DIR ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME})
-configure_file("${CMAKE_MODULE_PATH}/WiresharkConfig.cmake.in" "${CMAKE_BINARY_DIR}/WiresharkConfig.cmake" @ONLY)
-configure_file("${CMAKE_MODULE_PATH}/WiresharkConfigVersion.cmake.in" "${CMAKE_BINARY_DIR}/WiresharkConfigVersion.cmake" @ONLY)
+set(CMAKE_INSTALL_MODULES_DIR "${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/cmake")
install(
FILES
${CMAKE_MODULE_PATH}/FindGLIB2.cmake
- ${CMAKE_MODULE_PATH}/FindWireshark.cmake
${CMAKE_MODULE_PATH}/FindWSWinLibs.cmake
${CMAKE_MODULE_PATH}/UseAsn2Wrs.cmake
${CMAKE_MODULE_PATH}/LocatePythonModule.cmake
${CMAKE_MODULE_PATH}/UseMakePluginReg.cmake
- ${CMAKE_BINARY_DIR}/WiresharkConfig.cmake
- ${CMAKE_BINARY_DIR}/WiresharkConfigVersion.cmake
DESTINATION
${CMAKE_INSTALL_MODULES_DIR}
)
+include(CMakePackageConfigHelpers)
+
+configure_package_config_file(WiresharkConfig.cmake.in
+ ${CMAKE_BINARY_DIR}/WiresharkConfig.cmake
+ INSTALL_DESTINATION ${CMAKE_INSTALL_MODULES_DIR}
+ PATH_VARS
+ CMAKE_INSTALL_LIBDIR
+ CMAKE_INSTALL_INCLUDEDIR
+ PLUGIN_INSTALL_VERSION_LIBDIR
+ EXTCAP_INSTALL_LIBDIR
+)
+
+write_basic_package_version_file(
+ ${CMAKE_BINARY_DIR}/WiresharkConfigVersion.cmake
+ COMPATIBILITY AnyNewerVersion
+)
+
+# XXX On Windows wsutil depends on a CMake zlib target for which there are no
+# exports.
+if(NOT WIN32)
+ install(
+ FILES
+ ${CMAKE_BINARY_DIR}/WiresharkConfig.cmake
+ ${CMAKE_BINARY_DIR}/WiresharkConfigVersion.cmake
+ DESTINATION
+ ${CMAKE_INSTALL_MODULES_DIR}
+ )
+
+ install(EXPORT WiresharkTargets
+ DESTINATION ${CMAKE_INSTALL_MODULES_DIR}
+ )
+endif()
+
if (DOXYGEN_EXECUTABLE)
# API reference
# We don't have a good way of tracking dependencies, so we simply
enable_testing()
# We could try to build this list dynamically, but given that we tend to
# go years between adding suites just run
-# test/test.py --list-suites | sort
+# test/test.py --list-groups | sort
# and paste the output here.
-set(_test_suite_list
+set(_test_group_list
suite_capture
suite_clopts
suite_decryption
- suite_dfilter
+ suite_dfilter.group_bytes_ether
+ suite_dfilter.group_bytes_ipv6
+ suite_dfilter.group_bytes_type
+ suite_dfilter.group_double
+ suite_dfilter.group_integer
+ suite_dfilter.group_integer_1byte
+ suite_dfilter.group_ipv4
+ suite_dfilter.group_membership
+ suite_dfilter.group_range_method
+ suite_dfilter.group_scanner
+ suite_dfilter.group_string_type
+ suite_dfilter.group_stringz
+ suite_dfilter.group_time_relative
+ suite_dfilter.group_time_type
+ suite_dfilter.group_tvb
+ suite_dfilter.group_uint64
suite_dissection
suite_fileformats
+ suite_follow
suite_io
suite_mergecap
suite_nameres
suite_text2pcap
+ suite_sharkd
suite_unittests
suite_wslua
)
-if(WIN32)
- set(_test_suite_program_path ./run/$<CONFIG>)
-else()
- set(_test_suite_program_path ./run)
-endif()
# We don't currently handle spaces in arguments. On Windows this
# means that you will probably have to pass in an interface index
set(TEST_EXTRA_ARGS "" CACHE STRING "Extra arguments to pass to test/test.py")
separate_arguments(TEST_EXTRA_ARGS)
-foreach(_suite_name ${_test_suite_list})
+foreach(_group_name ${_test_group_list})
add_test(
- NAME ${_suite_name}
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/test/test.py
+ NAME ${_group_name}
+ COMMAND ${CMAKE_COMMAND} -E env PYTHONIOENCODING=UTF-8
+ ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/test/test.py
--verbose
- --program-path ${_test_suite_program_path}
+ --program-path ${WS_PROGRAM_PATH}
${TEST_EXTRA_ARGS}
- ${_suite_name}
+ ${_group_name}
)
- set_tests_properties(${_suite_name} PROPERTIES TIMEOUT 600)
+ set_tests_properties(${_group_name} PROPERTIES TIMEOUT 600)
endforeach()
if (GIT_EXECUTABLE)
# --external-sources requires 0.4.0 or later.
add_custom_command(TARGET shellcheck POST_BUILD
COMMAND shellcheck --external-sources
+ image/stock_icons/svg-to-png.sh
+ packaging/macosx/osx-app.sh.in
+ packaging/macosx/osx-dmg.sh.in
+ tools/compress-pngs.sh
+ tools/debian-setup.sh
+ tools/git-export-release.sh
tools/fuzz-test.sh
+ tools/gen-bugnote
+ tools/pre-commit
tools/randpkt-test.sh
+ tools/release-update-debian-soversions.sh
tools/test-captures.sh
+ tools/update-tx
tools/valgrind-wireshark.sh
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)