endif()
endif()
+if(WIN32)
+ # Linking with wsetargv.obj enables "wildcard expansion" of
+ # command-line arguments.
+ set(WILDCARD_OBJ wsetargv.obj)
+endif(WIN32)
+
# Banner shown at top right of Qt welcome screen.
if(DEFINED ENV{WIRESHARK_VERSION_FLAVOR})
set(VERSION_FLAVOR "$ENV{WIRESHARK_VERSION_FLAVOR}")
include(UseLemon)
include(UseMakePluginReg)
include(UseMakeTaps)
+include(UseExecutableResources)
include(UseAsn2Wrs)
# The following snippet has been taken from
-Wno-long-long
-Wheader-guard
-Wcomma
+ -Wshorten-64-to-32
)
- #
- # For -Wshorten-64-to-32, Apple's llvm-gcc doesn't seem to support
- # specifying -Werror and then specifying that -Wshorten-64-to-32
- # warnings should *not* be treated as errors - not with pragmas
- # and not even with -Werror ... -Wshorten-64-to-32 ...
- # -Wno-error=shorten-64-to-32.
- #
- # So we only add -Wshorten-64-to-32 if either 1) we're not building
- # on/for Apple or 2) we're using Clang.
- #
- # We also suppress -Wunused-function; that's enabled by -Wall,
- # but it's another warning that can be difficult to suppress
- # in generated code.
- #
- if ((NOT APPLE) OR CMAKE_C_COMPILER_ID MATCHES "Clang")
- list(APPEND WIRESHARK_COMMON_FLAGS
- -Wshorten-64-to-32
- -Wno-unused-function
- )
- endif()
-
#
# Code that may be worth looking into (coding practices)
#
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")
+ #
+ # 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()
set(PACKAGELIST ${PACKAGELIST} AIRPCAP)
endif()
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(PACKAGELIST ${PACKAGELIST} Systemd)
+endif()
+
# Build the Qt GUI?
if(BUILD_wireshark)
# Untested, may not work if CMAKE_PREFIX_PATH gets overwritten
endif()
endforeach()
-# Provide Windows system lib names
-include( UseWinLibs )
-
# dist target that prepares source dir
# XXX Duplicated in the RPM section below.
add_custom_target(dist
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
-
if(HAVE_LIBAIRPCAP)
set(HAVE_AIRPCAP 1)
endif()
set(ENABLE_CHECK_FILTER 1)
endif()
+#
+# Platform-specific additional libraries.
+#
+if(WIN32)
+ set(WIN_PSAPI_LIBRARY psapi.lib)
+ set(WIN_WSOCK32_LIBRARY wsock32.lib)
+ set(WIN_COMCTL32_LIBRARY comctl32.lib )
+ set(WIN_VERSION_LIBRARY version.lib)
+endif()
+
if(APPLE)
#
# We assume that APPLE means macOS so that we have the macOS
set(DOXYGEN_INPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
set(DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
-set(ICON_PATH "${CMAKE_SOURCE_DIR}/image/")
-set( IN_FILES
- doxygen.cfg.in
- image/libwireshark.rc.in
- image/text2pcap.rc.in
- image/capinfos.rc.in
- image/wireshark.rc.in
- image/mergecap.rc.in
- image/tshark.rc.in
- image/dumpcap.rc.in
- image/reordercap.rc.in
- image/rawshark.rc.in
- image/file_dlg_win32.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-app.sh.in
- packaging/macosx/osx-dmg.sh.in
- packaging/macosx/Wireshark_package.pmdoc/index.xml.in
- wireshark.pc.in
+set(CFG_OUT_FILES
+ doxygen.cfg
+ image/libwireshark.rc
+ image/wireshark.rc
+ image/dumpcap.rc
+ image/libwscodecs.rc
+ image/libwsutil.rc
+ image/wiretap.rc
+ image/wireshark.exe.manifest
+ packaging/macosx/Info.plist
+ packaging/macosx/osx-app.sh
+ packaging/macosx/osx-dmg.sh
+ packaging/macosx/Wireshark_package.pmdoc/index.xml
+ wireshark.pc
)
-foreach( _in_file ${IN_FILES} )
- get_filename_component( _path ${_in_file} PATH )
- string( REGEX REPLACE "(.*)\\.in" "\\1" _outfile ${_in_file} )
- configure_file( ${CMAKE_SOURCE_DIR}/${_in_file} ${CMAKE_BINARY_DIR}/${_outfile} @ONLY )
+foreach( _cfg_file ${CFG_OUT_FILES} )
+ configure_file( ${CMAKE_SOURCE_DIR}/${_cfg_file}.in ${CMAKE_BINARY_DIR}/${_cfg_file} @ONLY )
endforeach()
include(FeatureSummary)
)
set(wireshark_FILES
${WIRESHARK_SRC}
- ${CMAKE_BINARY_DIR}/image/wireshark.rc
${PLATFORM_UI_RC_FILES}
)
+ set_executable_resources(wireshark "Wireshark" UNIQUE_RC)
endif()
if(ENABLE_APPLICATION_BUNDLE)
# Common properties for CLI executables
macro(set_extra_executable_properties _executable _folder)
set_target_properties(${_executable} PROPERTIES
- LINK_FLAGS "${WS_LINK_FLAGS}"
+ LINK_FLAGS "${WILDCARD_OBJ} ${WS_LINK_FLAGS}"
FOLDER ${_folder}
)
tshark.c
${TSHARK_TAP_SRC}
${SHARK_COMMON_SRC}
- ${CMAKE_BINARY_DIR}/image/tshark.rc
)
+ set_executable_resources(tshark "TShark" UNIQUE_RC)
add_executable(tshark ${tshark_FILES})
add_dependencies(tshark version)
set_extra_executable_properties(tshark "Executables")
tfshark.c
${TSHARK_TAP_SRC}
${SHARK_COMMON_SRC}
- ${CMAKE_BINARY_DIR}/image/tfshark.rc
)
+ set_executable_resources(tfshark "TFShark")
add_executable(tfshark ${tfshark_FILES})
add_dependencies(tfshark version)
set_extra_executable_properties(tfshark "Executables")
set(rawshark_FILES
${SHARK_COMMON_SRC}
rawshark.c
- ${CMAKE_BINARY_DIR}/image/rawshark.rc
)
+ set_executable_resources(rawshark "Rawshark")
add_executable(rawshark ${rawshark_FILES})
add_dependencies(rawshark version)
set_extra_executable_properties(rawshark "Executables")
sharkd_session.c
${SHARK_COMMON_SRC}
)
+ set_executable_resources(sharkd "SharkD")
add_executable(sharkd ${sharkd_FILES})
add_dependencies(sharkd version)
set_extra_executable_properties(sharkd "Executables")
add_lex_files(text2pcap_LEX_FILES text2pcap_FILES
text2pcap-scanner.l
)
- add_executable(text2pcap ${text2pcap_FILES}
- ${CMAKE_BINARY_DIR}/image/text2pcap.rc)
+ set_executable_resources(text2pcap "Text2pcap"
+ COPYRIGHT_INFO "2001 Ashok Narayanan <ashokn@cisco.com>")
+ add_executable(text2pcap ${text2pcap_FILES})
add_dependencies(text2pcap version)
set_extra_executable_properties(text2pcap "Executables")
target_link_libraries(text2pcap ${text2pcap_LIBS})
set(mergecap_FILES
mergecap.c
version_info.c
- ${CMAKE_BINARY_DIR}/image/mergecap.rc
)
+ set_executable_resources(mergecap "Mergecap")
add_executable(mergecap ${mergecap_FILES})
add_dependencies(mergecap version)
set_extra_executable_properties(mergecap "Executables")
set(reordercap_FILES
reordercap.c
version_info.c
- ${CMAKE_BINARY_DIR}/image/reordercap.rc
)
+ set_executable_resources(reordercap "Reordercap")
add_executable(reordercap ${reordercap_FILES})
add_dependencies(reordercap version)
set_extra_executable_properties(reordercap "Executables")
set(capinfos_FILES
capinfos.c
version_info.c
- ${CMAKE_BINARY_DIR}/image/capinfos.rc
)
+ set_executable_resources(capinfos "Capinfos")
add_executable(capinfos ${capinfos_FILES})
add_dependencies(capinfos version)
set_extra_executable_properties(capinfos "Executables")
set(captype_FILES
captype.c
version_info.c
- ${CMAKE_BINARY_DIR}/image/captype.rc
)
+ set_executable_resources(captype "Captype")
add_executable(captype ${captype_FILES})
add_dependencies(captype version)
set_extra_executable_properties(captype "Executables")
set(editcap_FILES
editcap.c
version_info.c
- ${CMAKE_BINARY_DIR}/image/editcap.rc
)
+ set_executable_resources(editcap "Editcap")
add_executable(editcap ${editcap_FILES})
add_dependencies(editcap version)
set_extra_executable_properties(editcap "Executables")
ringbuffer.c
sync_pipe_write.c
version_info.c
- ${CMAKE_BINARY_DIR}/image/dumpcap.rc
)
+ set_executable_resources(dumpcap "Dumpcap" UNIQUE_RC)
add_executable(dumpcap ${dumpcap_FILES})
add_dependencies(dumpcap version)
set_extra_executable_properties(dumpcap "Executables")
if(CMAKE_GENERATOR STREQUAL "Ninja")
list(APPEND _rpmbuild_with_args --with ninja)
endif()
+ if(CCACHE_EXECUTABLE)
+ list(APPEND _rpmbuild_with_args --with ccache)
+ endif()
if (BUILD_wireshark)
list(APPEND _rpmbuild_with_args --with qt5)
endif()
- if (BUILD_mmdbresolve)
+ if (MAXMINDDB_FOUND)
list(APPEND _rpmbuild_with_args --with mmdbresolve)
endif()
if (LUA_FOUND)
if (NGHTTP2_FOUND)
list(APPEND _rpmbuild_with_args --with nghttp2)
endif()
+ if (SYSTEMD_FOUND)
+ list(APPEND _rpmbuild_with_args --with sdjournal)
+ endif()
execute_process(
COMMAND ${PERL_EXECUTABLE}