endif()
message(STATUS "Building for ${WIRESHARK_TARGET_PLATFORM} using ${CMAKE_GENERATOR}")
- # Determine where the 3rd party libraries will be
+ # Determine where the 3rd party libraries will be
if( DEFINED ENV{WIRESHARK_LIB_DIR} )
# The buildbots set WIRESHARK_LIB_DIR but not WIRESHARK_BASE_DIR.
file( TO_CMAKE_PATH "$ENV{WIRESHARK_LIB_DIR}" _PROJECT_LIB_DIR )
elseif( DEFINED ENV{WIRESHARK_BASE_DIR} )
file( TO_CMAKE_PATH "$ENV{WIRESHARK_BASE_DIR}" _WS_BASE_DIR )
set( _PROJECT_LIB_DIR "${_WS_BASE_DIR}/wireshark-${WIRESHARK_TARGET_PLATFORM}-libs" )
- else()
- # Don't know what to do
- message(FATAL_ERROR "Neither WIRESHARK_BASE_DIR or WIRESHARK_LIB_DIR are defined")
+ else()
+ # Don't know what to do
+ message(FATAL_ERROR "Neither WIRESHARK_BASE_DIR or WIRESHARK_LIB_DIR are defined")
endif()
# Download third-party libraries
elseif(MSVC10)
set(_vsversion_args "10")
else()
- message(FATAL_ERROR "Unsupported compiler ${CMAKE_C_COMPILER}")
+ 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} -VSVersion ${_vsversion_args}
RESULT_VARIABLE _win_setup_failed
)
if (${_win_setup_failed})
FORCE)
endif()
message(STATUS "Configuration types: ${CMAKE_CONFIGURATION_TYPES}")
-
-# Override optimization and other flags for make based generators
-foreach (_BT DEBUG RELEASE RELWITHDEBINFO SIZEREL)
- set( CMAKE_C_FLAGS_${_BT} "${CMAKE_C_FLAGS_${_BT}} ${CMAKE_C_FLAGS}" )
- set( CMAKE_CXX_FLAGS_${_BT} "${CMAKE_C_FLAGS_${_BT}} ${CMAKE_C_FLAGS}" )
-endforeach()
-
-message(STATUS "${CMAKE_BUILD_TYPE}: ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
+string(TOUPPER "${CMAKE_BUILD_TYPE}" _build_type)
+message(STATUS "CMAKE_C_FLAGS_${_build_type}: ${CMAKE_C_FLAGS_${_build_type}}")
+message(STATUS "CMAKE_CXX_FLAGS_${_build_type}: ${CMAKE_CXX_FLAGS_${_build_type}}")
# Where to put executables and libraries in the build tree
# Note: Executables and libraries might end end up in a configuration
set( DUMPCAP_INSTALL_OPTION )
endif()
-# Always enable -fPIE (or -fPIC). -pie is added below for non-MSVC.
+# Always enable position-independent code when compiling, even for
+# executables, so you can build position-independent executables.
+# -pie is added below for non-MSVC.
# Needed when either:
# - Qt5_POSITION_INDEPENDENT_CODE is set and CMake < 2.8.11
# - PIE is wanted (-pie) and you want to add -fPIC/-fPIE automatically.
-Wignored-qualifiers
-Wpragmas
-Wno-overlength-strings
- -Wwrite-strings
-Wno-long-long
-Wheader-guard
-Wunused-const-variable
set(WIRESHARK_EXTRA_COMPILER_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.
#
if( NOT CMAKE_C_COMPILER_ID MATCHES "MSVC")
#
- # Try the GCC-and-copatible -fvisibility-hidden first.
+ # Try the GCC-and-compatible -fvisibility-hidden first.
#
check_c_compiler_flag(-fvisibility=hidden FVHIDDEN)
if(FVHIDDEN)
set (C_UNUSED "" )
endif()
-
-if(NOT CMAKE_C_COMPILER_ID MATCHES "MSVC")
- set(WIRESHARK_LD_FLAGS
- -Wl,--as-needed
- # -flto
- # -fwhopr
- # -fwhole-program
+set(WIRESHARK_LD_FLAGS
+ -Wl,--as-needed
+ # -flto
+ # -fwhopr
+ # -fwhole-program
+)
+# 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
)
- # CMAKE_POSITION_INDEPENDENT_CODE is only supported starting with CMake
- # 2.8.9. Do not add -pie automatically for older versions.
- if(NOT CMAKE_VERSION VERSION_LESS "2.8.9")
- set(WIRESHARK_LD_FLAGS ${WIRESHARK_LD_FLAGS}
- -pie
- )
- endif()
endif()
include(CheckCLinkerFlag)
# - set HAVE_XXX
#The minimum package list
-set(PACKAGELIST Gettext M GLIB2 GMODULE2 GTHREAD2 LEX YACC Perl SED SH PythonInterp)
+set(PACKAGELIST Gettext M Git GLIB2 GMODULE2 GTHREAD2 LEX YACC Perl SED SH PythonInterp)
set(LEX_REQUIRED TRUE)
set(GLIB2_REQUIRED TRUE)
set(GLIB2_FIND_REQUIRED TRUE)
set(PACKAGELIST ${PACKAGELIST} HtmlViewer)
+set(PACKAGELIST ${PACKAGELIST} LIBSSH)
+set(LIBSSH_OPTIONS "0.6")
+
if(ENABLE_PCAP)
set(PACKAGELIST ${PACKAGELIST} PCAP)
endif()
Qt5LinguistTools
Qt5Multimedia
Qt5PrintSupport
+ Qt5Svg
Qt5Widgets
)
if (APPLE)
if (WIN32)
# On Windows we build our own version of zlib, so add the paths
set(ZLIB_SRC_DIR "${_PROJECT_LIB_DIR}/zlib-1.2.8-ws")
+ set(SKIP_INSTALL_ALL True) # We copy the DLL ourselves.
add_subdirectory("${ZLIB_SRC_DIR}" "${CMAKE_BINARY_DIR}/zlib")
+ unset(SKIP_INSTALL_ALL)
set(ZLIB_INCLUDE_DIR "${ZLIB_SRC_DIR}" "${CMAKE_BINARY_DIR}/zlib")
set(ZLIB_LIBRARY zlib)
set(ZLIB_DLL "zlib1.dll")
if(HAVE_LIBGEOIP)
set(HAVE_GEOIP 1)
endif()
+if(LIBSSH_FOUND)
+ set(HAVE_LIBSSH 1)
+endif()
if(HAVE_LIBCARES)
set(HAVE_C_ARES 1)
endif()
endif()
if (Qt5Widgets_FOUND)
#
- # Qt5CoreConfigExtras.cmake in Qt 5.5.0 sets -fPIC unconditionally.
- # https://bugreports.qt.io/browse/QTBUG-47942
+ # Qt5CoreConfigExtras.cmake in Qt 5.5.0 sets -fPIC unconditionally:
#
- # If it was added, we remove it, and then check whether it's
- # necessary the same way we do for autotools, by checking
- # whether we can compile and link a simple file with just
+ # https://bugreports.qt.io/browse/QTBUG-47942
#
- # #include <QtCore>
- # int main() {}
+ # There's a fix in Gerrit for that:
#
- # (Yes, check_XXX_source_compiles() should be renamed
- # check_XXX_source_compiles_and_links().)
+ # https://codereview.qt-project.org/#/c/139645/
#
- if ("${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}" MATCHES ".*-fPIC.*")
+ # Do the same check as that fix does and, if the check says we
+ # should *not* add -fPIC, remove it.
+ #
+ # XXX - if that check gets changed in the future, we'll have to
+ # detect that and change it.
+ #
+ if (CMAKE_VERSION VERSION_LESS 2.8.12
+ AND (CMAKE_CXX_COMPILER_ID STREQUAL \"GNU\"
+ AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))
+ #
+ # Yes, it should have been; leave it there.
+ #
+ else()
+ #
+ # No, it shouldn't have been; remove it.
+ #
list(REMOVE_ITEM Qt5Widgets_EXECUTABLE_COMPILE_FLAGS "-fPIC")
- set(CMAKE_REQUIRED_FLAGS ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS})
- set(CMAKE_REQUIRED_INCLUDES ${Qt5Core_INCLUDE_DIRS})
- set(CMAKE_REQUIRED_LIBS ${Qt5Core_LIBRARIES})
- check_cxx_source_compiles(
- "#include <QtCore>
- int main() {}"
- WORKS_WITHOUT_FPIC)
- if (NOT WORKS_WITHOUT_FPIC)
- #
- # OK, it won't compile without -fPIC. Try adding it.
- #
- set(CMAKE_REQUIRED_FLAGS "-fPIC")
- check_cxx_source_compiles(
- "#include <QtCore>
- int main() {}"
- WORKS_WITH_FPIC)
- if (NOT WORKS_WITH_FPIC)
- #
- # It won't build with -fPIC or without -fPIC,
- # so we're hosed.
- #
- message(FATAL_ERROR "Couldn't compile Qt without -fPIC nor with -fPIC")
- endif()
-
- #
- # It compiles with -fPIC, so add it back.
- #
- list(APPEND Qt5Widgets_EXECUTABLE_COMPILE_FLAGS "-fPIC")
- endif()
- set(CMAKE_REQUIRED_FLAGS "")
- set(CMAKE_REQUIRED_INCLUDES "")
- set(CMAKE_REQUIRED_LIBS "")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
set (QT_FOUND ON)
# That's the name autofoo uses
set(QT_MULTIMEDIA_LIB 1)
endif()
+ if(Qt5Svg_FOUND)
+ set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5Svg_LIBRARIES})
+ # That's the name autofoo uses
+ set(QT_SVG_LIB 1)
+ endif()
if(Qt5MacExtras_FOUND)
set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5MacExtras_LIBRARIES})
# That's the name autofoo uses
add_subdirectory( wsutil )
if(NOT WIN32)
- add_custom_target(dumpabi DEPENDS dumpabi-libwireshark dumpabi-libwiretap dumpabi-libwsutil color.h)
+ add_custom_target(dumpabi DEPENDS dumpabi-libwireshark dumpabi-libwiretap dumpabi-libwsutil)
endif()
if(ENABLE_ECHLD)
get_target_property(_libwireshark_location epan LOCATION)
get_filename_component(_datafile_dir "${_libwireshark_location}" PATH)
endif()
-set (DATAFILE_DIR ${_datafile_dir} CACHE INTERNAL "Build time data file location.")
-if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
- set(ABSOLUTE_CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
-else()
- set(ABSOLUTE_CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
-endif()
+set(DATAFILE_DIR ${_datafile_dir} CACHE INTERNAL "Build time data file location.")
if(ENABLE_EXTCAP)
+ # Target platform locations
+ # UNIX, Linux, non-bundled OS X: $DESTDIR/lib/wireshark/extcap
+ # Windows: $DESTDIR/extcap
+ # OS X app bundle: Wireshark.app/Contents/Resources/share/wireshark/extcap
set(HAVE_EXTCAP 1)
- set(EXTCAP_DIR "${ABSOLUTE_CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/extcap/")
+ if (WIN32)
+ set(EXTCAP_DIR "extcap")
+ else ()
+ set(EXTCAP_DIR "${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/extcap")
+ endif()
+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()
# Location of our plugins. PLUGIN_DIRECTORY should allow running
# from the build directory similar to DATAFILE_DIR above.
if(ENABLE_PLUGINS)
+ # Target platform locations
+ # UNIX, Linux, non-bundled OS X: $DESTDIR/lib/wireshark/plugins/$VERSION
+ # Windows: $DESTDIR/wireshark/plubins/$VERSION
+ # OS X app bundle: Wireshark.app/Contents/PlugIns/wireshark
set(HAVE_PLUGINS 1)
add_custom_target(plugins)
set_target_properties(plugins PROPERTIES FOLDER "Plugins")
- set(PLUGIN_INSTALL_DIR "${ABSOLUTE_CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}")
+ if (WIN32)
+ set(PLUGIN_INSTALL_DIR "plugins/${CPACK_PACKAGE_VERSION}")
+ else ()
+ set(PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}")
+ endif()
set(PLUGIN_SRC_DIRS
plugins/docsis
plugins/ethercat
set(WS_MSVC_NORETURN " ")
endif()
+if (${GIT_EXECUTABLE})
+ set(GIT_BIN_PARAM "--git-bin ${GIT_EXECUTABLE}")
+endif()
set( VERSION ${PROJECT_VERSION} )
execute_process(
COMMAND ${PERL_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
- --print-vcs
+ --print-vcs ${GIT_BIN_PARAM}
${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE VERSION_H_CONTENT
)
configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_BINARY_DIR}/version.h)
#set_target_properties(${CMAKE_BINARY_DIR}/version.h PROPERTIES FOLDER "Auxiliary")
+set( prefix "${CMAKE_INSTALL_PREFIX}" )
+set( exec_prefix "\${prefix}" )
+set( libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}" )
+set( includedir "\${prefix}/include" )
+set( plugindir "\${libdir}/wireshark/plugins/${CPACK_PACKAGE_VERSION}" )
+
set(ICON_PATH "${CMAKE_SOURCE_DIR}/image/")
set( IN_FILES
adns_dll.rc
image/tfshark.rc.in
image/editcap.rc.in
image/captype.rc.in
+ image/libwscodecs.rc.in
image/libwsutil.rc.in
image/wiretap.rc.in
image/wireshark.exe.manifest.in
packaging/macosx/Info.plist.in
packaging/macosx/osx-dmg.sh.in
packaging/macosx/Wireshark_package.pmdoc/index.xml.in
- ${CUSTOM_PLUGIN_IN_FILES}
ui/doxygen.cfg.in
ui/gtk/doxygen.cfg.in
ui/qt/doxygen.cfg.in
include(FeatureSummary)
#SET_FEATURE_INFO(NAME DESCRIPTION [URL [COMMENT] ])
SET_FEATURE_INFO(SBC "SBC Codec for Bluetooth A2DP stream playing" "www: http://git.kernel.org/cgit/bluetooth/sbc.git" )
+SET_FEATURE_INFO(LIBSSH "libssh is library for ssh connections and it is needed to build sshdump" "www: https://www.libssh.org/get-it/" )
FEATURE_SUMMARY(WHAT ALL)
set(INSTALL_FILES
${CMAKE_BINARY_DIR}/androiddump.html
+ ${CMAKE_BINARY_DIR}/sshdump.html
${CMAKE_BINARY_DIR}/AUTHORS-SHORT
${CMAKE_BINARY_DIR}/capinfos.html
${CMAKE_BINARY_DIR}/captype.html
${CMAKE_BINARY_DIR}/mergecap.html
pdml2html.xsl
${CMAKE_BINARY_DIR}/randpkt.html
+ ${CMAKE_BINARY_DIR}/randpktdump.html
${CMAKE_BINARY_DIR}/rawshark.html
${CMAKE_BINARY_DIR}/reordercap.html
services
${CMAKE_BINARY_DIR}/idl2wrs.1
${CMAKE_BINARY_DIR}/mergecap.1
${CMAKE_BINARY_DIR}/randpkt.1
+ ${CMAKE_BINARY_DIR}/androiddump.1
${CMAKE_BINARY_DIR}/rawshark.1
${CMAKE_BINARY_DIR}/reordercap.1
+ ${CMAKE_BINARY_DIR}/sshdump.1
${CMAKE_BINARY_DIR}/text2pcap.1
${CMAKE_BINARY_DIR}/tshark.1
${CMAKE_BINARY_DIR}/wireshark.1
"${_dll_output_dir}"
)
endif(GEOIP_FOUND)
+ if (LIBSSH_FOUND)
+ add_custom_command(TARGET copy_cli_dlls PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${LIBSSH_DLL_DIR}/${LIBSSH_DLL}"
+ "${_dll_output_dir}"
+ )
+ endif(LIBSSH_FOUND)
if(GCRYPT_FOUND)
foreach( _dll ${GCRYPT_DLLS} )
add_custom_command(TARGET copy_cli_dlls PRE_BUILD
endif()
endif(WIN32)
-# Copy ${INSTALL_FILES} and ${INSTALL_DIRS} to ${DATAFILE_DIR}
-add_custom_target(copy_data_files ALL DEPENDS ${INSTALL_FILES})
-set_target_properties(copy_data_files PROPERTIES FOLDER "Copy Tasks")
-add_dependencies(copy_data_files html_docs)
-if(ENABLE_APPLICATION_BUNDLE)
- add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}"
- )
-endif()
+# List of extra dependencies for the "copy_data_files" target
+set(copy_data_files_depends)
+
+# glob patterns relative to the source directory that should be copied to
+# ${DATAFILE_DIR} (including directory prefixes)
+set(DATA_FILES_SRC
+ "help/toc"
+)
if(WIN32)
foreach(_text_file ${TEXTIFY_FILES})
foreach(_install_file ${INSTALL_FILES})
get_filename_component(_install_basename "${_install_file}" NAME)
- add_custom_command(TARGET copy_data_files POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ set(_output_file "${DATAFILE_DIR}/${_install_basename}")
+ add_custom_command(OUTPUT "${_output_file}"
+ COMMAND ${CMAKE_COMMAND} -E copy
"${_install_file}"
- "${DATAFILE_DIR}/${_install_basename}"
+ "${_output_file}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ DEPENDS
+ html_docs
+ "${_install_file}"
)
+ list(APPEND copy_data_files_depends "${_output_file}")
endforeach()
if(ENABLE_EXTCAP)
- add_custom_command(TARGET copy_data_files PRE_BUILD
+ # 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")
endif()
-add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory
- "${DATAFILE_DIR}/help"
-)
-add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- "${CMAKE_SOURCE_DIR}/help/toc"
- "${DATAFILE_DIR}/help/toc"
+set(_help_files
+ help/capture_filters.txt
+ help/capturing.txt
+ help/display_filters.txt
+ help/getting_started.txt
+ help/overview.txt
)
if(WIN32)
- file(TO_NATIVE_PATH ${DATAFILE_DIR}/help _help_dest_dir)
- add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${POWERSHELL_COMMAND} "${CMAKE_SOURCE_DIR}/tools/textify.ps1"
- -Destination ${_help_dest_dir}
- ${CMAKE_SOURCE_DIR}/help/*.txt
- )
-else()
- file(GLOB _help_files
- "${CMAKE_SOURCE_DIR}/help/*.txt"
- )
- foreach(_help_file ${_help_files})
- add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- "${_help_file}"
- "${DATAFILE_DIR}/help/"
+ file(TO_NATIVE_PATH "${DATAFILE_DIR}/help" _help_dest_dir)
+ foreach(_help_file IN LISTS _help_files)
+ add_custom_command(OUTPUT "${DATAFILE_DIR}/${_help_file}"
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/help"
+ COMMAND ${POWERSHELL_COMMAND} "${CMAKE_SOURCE_DIR}/tools/textify.ps1"
+ -Destination "${_help_dest_dir}"
+ "${CMAKE_SOURCE_DIR}/${_help_file}"
+ DEPENDS
+ "${CMAKE_SOURCE_DIR}/${_help_file}"
)
+ list(APPEND copy_data_files_depends "${DATAFILE_DIR}/${_help_file}")
endforeach()
+else()
+ list(APPEND DATA_FILES_SRC ${_help_files})
endif(WIN32)
-add_custom_command(TARGET copy_data_files PRE_BUILD
+
+# Create help/faq.txt when missing
+add_custom_command(OUTPUT "${DATAFILE_DIR}/help/faq.txt"
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/help"
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/help/faq.py -b > faq.tmp.html
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/html2text.py
faq.tmp.html > "${DATAFILE_DIR}/help/faq.txt"
COMMAND ${CMAKE_COMMAND} -E remove faq.tmp.html
+ DEPENDS
+ "${CMAKE_SOURCE_DIR}/help/faq.py"
+ "${CMAKE_SOURCE_DIR}/tools/html2text.py"
)
-
-if(LUA_FOUND)
- add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory
- "${DATAFILE_DIR}/lua"
- )
- add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- "${CMAKE_BINARY_DIR}/epan/wslua/init.lua"
- "${DATAFILE_DIR}"
- )
- add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- "${CMAKE_SOURCE_DIR}/epan/wslua/console.lua"
- "${DATAFILE_DIR}"
- )
- add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- "${CMAKE_SOURCE_DIR}/epan/wslua/dtd_gen.lua"
- "${DATAFILE_DIR}"
- )
- add_dependencies(copy_data_files wsluaauxiliary)
-endif(LUA_FOUND)
+list(APPEND copy_data_files_depends "${DATAFILE_DIR}/help/faq.txt")
+
+# 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_BINARY_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
+ "${_lua_file}"
+ "${DATAFILE_DIR}/${_lua_filename}"
+ DEPENDS
+ wsluaauxiliary
+ "${_lua_file}"
+ )
+ endforeach()
+endif(LUA_FOUND AND ENABLE_LUA)
# doc/*.html handled elsewhere.
-add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_directory
- "${CMAKE_SOURCE_DIR}/dtds"
- "${DATAFILE_DIR}/dtds"
-)
-# Skipping asn1 default.tt
-add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_directory
- "${CMAKE_SOURCE_DIR}/radius"
- "${DATAFILE_DIR}/radius"
-)
-add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory
- "${DATAFILE_DIR}/diameter"
-)
-file(GLOB _diameter_files
- "${CMAKE_SOURCE_DIR}/diameter/*.dtd"
- "${CMAKE_SOURCE_DIR}/diameter/*.xml"
+
+# TODO shouldn't this use full (relative) paths instead of glob patterns?
+list(APPEND DATA_FILES_SRC
+ "dtds/*.dtd"
+
+ "radius/README.radius_dictionary"
+ "radius/custom.includes"
+ "radius/dictionary"
+ "radius/dictionary.*"
+
+ "diameter/*.dtd"
+ "diameter/*.xml"
+ "profiles/*/*"
+ "tpncp/tpncp.dat"
+ "wimaxasncp/*.dtd"
+ "wimaxasncp/*.xml"
)
-foreach(_diameter_file ${_diameter_files})
- add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- "${_diameter_file}"
- "${DATAFILE_DIR}/diameter/"
- )
+
+# Copy all paths from the source tree to the data directory. Directories are
+# automatically created if missing as the filename is given.
+file(GLOB _data_files RELATIVE "${CMAKE_SOURCE_DIR}" ${DATA_FILES_SRC})
+foreach(_data_file ${_data_files})
+ add_custom_command(OUTPUT "${DATAFILE_DIR}/${_data_file}"
+ COMMAND ${CMAKE_COMMAND} -E copy
+ "${CMAKE_SOURCE_DIR}/${_data_file}"
+ "${DATAFILE_DIR}/${_data_file}"
+ DEPENDS
+ "${CMAKE_SOURCE_DIR}/${_data_file}"
+ )
+ list(APPEND copy_data_files_depends "${DATAFILE_DIR}/${_data_file}")
endforeach()
-add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_directory
- "${CMAKE_SOURCE_DIR}/profiles"
- "${DATAFILE_DIR}/profiles"
-)
-add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory
- "${DATAFILE_DIR}/tpncp"
-)
-add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- "${CMAKE_SOURCE_DIR}/tpncp/tpncp.dat"
- "${DATAFILE_DIR}/tpncp/tpncp.dat"
-)
-add_custom_command(TARGET copy_data_files PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_directory
- "${CMAKE_SOURCE_DIR}/wimaxasncp"
- "${DATAFILE_DIR}/wimaxasncp"
-)
+
+# Copy files including ${INSTALL_FILES} and ${INSTALL_DIRS} to ${DATAFILE_DIR}
+add_custom_target(copy_data_files ALL DEPENDS ${copy_data_files_depends})
+set_target_properties(copy_data_files PROPERTIES FOLDER "Copy Tasks")
if( (BUILD_wireshark AND QT_FOUND) OR (BUILD_wireshark_gtk AND GTK_FOUND) )
set(WIRESHARK_SRC
capture_info.c
capture_opts.c
- color_filters.c
file.c
fileset.c
summary.c
caputils
${QT_LIBRARIES}
${GTHREAD2_LIBRARIES}
- codecs
+ wscodecs
${LIBEPAN_LIBS}
${APPLE_APPLICATION_SERVICES_LIBRARY}
${APPLE_CORE_FOUNDATION_LIBRARY}
endmacro()
macro(set_extcap_executable_properties _executable)
- set_target_properties(androiddump PROPERTIES FOLDER "Executables/Extcaps")
+ set_target_properties(${_executable} PROPERTIES FOLDER "Executables/Extcaps")
set(PROGLIST ${PROGLIST} ${_executable})
${GTK2_LIBRARIES}
${GTK3_LIBRARIES}
${GTHREAD2_LIBRARIES}
- codecs
+ wscodecs
${PORTAUDIO_LIBRARIES}
${LIBEPAN_LIBS}
${APPLE_APPLICATION_SERVICES_LIBRARY}
endif()
if (WIN32)
+ find_package( MSVC_REDIST )
+
# Must come after executable targets are defined.
find_package( NSIS )
install(TARGETS androiddump RUNTIME DESTINATION ${EXTCAP_DIR})
endif()
+if(BUILD_sshdump AND LIBSSH_FOUND)
+ set(sshdump_LIBS
+ ${GLIB2_LIBRARIES}
+ ${CMAKE_DL_LIBS}
+ ${LIBSSH_LIBRARIES}
+ )
+ if (WIN32)
+ set(sshdump_LIBS wsutil ${sshdump_LIBS})
+ endif()
+ set(sshdump_FILES
+ extcap/sshdump.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})
+elseif (BUILD_sshdump)
+ #message( WARNING "Cannot find libssh, cannot build sshdump" )
+endif()
+
+if(BUILD_randpktdump)
+ set(randpktdump_LIBS
+ wiretap
+ ${GLIB2_LIBRARIES}
+ ${CMAKE_DL_LIBS}
+ )
+ set(randpktdump_FILES
+ extcap/randpktdump.c
+ randpkt-core.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})
+endif()
+
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
COMMAND ${PERL_EXECUTABLE}
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/randpktdump 1 )
pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/rawshark 1 )
pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/reordercap 1 )
+pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/sshdump 1 )
pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/text2pcap 1 )
pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/tshark 1 )
pod2manhtml( ${CMAKE_BINARY_DIR}/wireshark 1 )
idl2wrs.html
mergecap.html
randpkt.html
+ randpktdump.html
rawshark.html
reordercap.html
+ sshdump.html
text2pcap.html
tshark.html
wireshark.html
${rawshark_FILES}
${dftest_FILES}
${randpkt_FILES}
+ ${randpktdump_FILES}
${text2pcap_CLEAN_FILES}
${mergecap_FILES}
${capinfos_FILES}
${editcap_FILES}
${dumpcap_FILES}
${androiddump_FILES}
+ ${sshdump_FILES}
)
if (WERROR_COMMON_FLAGS)
if (WIN32)
file (TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/tools/Get-HardenFlags.ps1 _win_harden_flags)
add_custom_target(hardening-check
- COMMAND ${POWERSHELL_COMMAND} "${_win_harden_flags}" "${CMAKE_BINARY_DIR}"
+ COMMAND ${POWERSHELL_COMMAND} "${_win_harden_flags}" "${_dll_output_dir_win}"
DEPENDS ${PROGLIST}
COMMENT "Checking binaries for security features"
)