3 # Wireshark - Network traffic analyzer
4 # By Gerald Combs <gerald@wireshark.org>
5 # Copyright 1998 Gerald Combs
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
9 # as published by the Free Software Foundation; either version 2
10 # of the License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 project(Wireshark C CXX)
24 message(STATUS "Generating build using CMake ${CMAKE_VERSION}")
26 # Needed for proper Qt linking. See
27 # http://www.cmake.org/cmake/help/v3.0/policy/CMP0020.html
28 # 3.1.3 is the currently supported version
29 cmake_minimum_required(VERSION 3.1.3)
31 cmake_minimum_required(VERSION 2.8.3)
34 # Needs to be set after cmake_minimum_required or cmake_policy(VERSION)
36 cmake_policy(SET CMP0008 NEW)
38 # Backward compatibility for versions < 2.6.3
39 cmake_policy(SET CMP0011 OLD)
41 cmake_policy(SET CMP0015 NEW)
43 #Where to find local cmake scripts
44 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
46 # Set old behaviour for LOCATION property
48 cmake_policy(SET CMP0026 OLD)
51 # Set old behaviour for variable quoting
53 cmake_policy(SET CMP0054 OLD)
56 # Set old behaviour for MACOSX_RPATH
58 cmake_policy(SET CMP0042 OLD)
61 # If our target platform is enforced by our generator, set
62 # WIRESHARK_TARGET_PLATFORM accordingly. Otherwise use
63 # %WIRESHARK_TARGET_PLATFORM%.
66 find_package(PowerShell REQUIRED)
68 if(${CMAKE_CL_64} OR "${CMAKE_GENERATOR}" MATCHES "Win64")
69 set(WIRESHARK_TARGET_PLATFORM win64)
70 elseif("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
71 set(WIRESHARK_TARGET_PLATFORM win32)
73 set(WIRESHARK_TARGET_PLATFORM $ENV{WIRESHARK_TARGET_PLATFORM})
76 if ("${WIRESHARK_TARGET_PLATFORM}" MATCHES "win64")
77 set(PROCESSOR_ARCHITECTURE amd64)
79 set(PROCESSOR_ARCHITECTURE x86)
83 if(DEFINED ENV{PLATFORM})
84 string(TOLOWER $ENV{PLATFORM} _vs_platform)
86 set(_vs_platform "[undefined]") # x86
89 (_vs_platform STREQUAL "x64" AND NOT WIRESHARK_TARGET_PLATFORM STREQUAL "win64")
91 (_vs_platform STREQUAL "[undefined]" AND NOT WIRESHARK_TARGET_PLATFORM STREQUAL "win32")
93 message(FATAL_ERROR "The PLATFORM environment variable (${_vs_platform})"
94 " doesn't match the generator platform (${WIRESHARK_TARGET_PLATFORM})")
96 message(STATUS "Building for ${WIRESHARK_TARGET_PLATFORM} using ${CMAKE_GENERATOR}")
98 # Determine where the 3rd party libraries will be
99 if( DEFINED ENV{WIRESHARK_LIB_DIR} )
100 # The buildbots set WIRESHARK_LIB_DIR but not WIRESHARK_BASE_DIR.
101 file( TO_CMAKE_PATH "$ENV{WIRESHARK_LIB_DIR}" _PROJECT_LIB_DIR )
102 elseif( DEFINED ENV{WIRESHARK_BASE_DIR} )
103 file( TO_CMAKE_PATH "$ENV{WIRESHARK_BASE_DIR}" _WS_BASE_DIR )
104 set( _PROJECT_LIB_DIR "${_WS_BASE_DIR}/wireshark-${WIRESHARK_TARGET_PLATFORM}-libs" )
106 # Don't know what to do
107 message(FATAL_ERROR "Neither WIRESHARK_BASE_DIR or WIRESHARK_LIB_DIR are defined")
110 # Download third-party libraries
111 file (TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/tools/win-setup.ps1 _win_setup)
112 file (TO_NATIVE_PATH ${_PROJECT_LIB_DIR} _ws_lib_dir)
114 set(_vsversion_args "14")
116 set(_vsversion_args "12")
118 set(_vsversion_args "11")
120 set(_vsversion_args "10")
122 message(FATAL_ERROR "Unsupported compiler ${CMAKE_C_COMPILER}")
125 # Is it possible to have a one-time, non-cached option in CMake? If
126 # so, we could add a "-DFORCE_WIN_SETUP" which passes -Force to
129 COMMAND ${POWERSHELL_COMMAND} "\"${_win_setup}\"" -Destination "${_ws_lib_dir}" -Platform ${WIRESHARK_TARGET_PLATFORM} -VSVersion ${_vsversion_args}
130 RESULT_VARIABLE _win_setup_failed
132 if (${_win_setup_failed})
133 message(FATAL_ERROR "Windows setup (win-setup.ps1) failed.")
136 # XXX Add a dependency on ${_ws_lib_dir}/current_tag.txt?
138 # Head off any attempts to use Cygwin's Python.
139 include(LocatePythonExecutable)
142 include(UseCustomIncludes)
143 ADD_CUSTOM_CMAKE_INCLUDE()
145 # This cannot be implemented via option(...)
146 if( NOT CMAKE_BUILD_TYPE )
147 set( CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
148 "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
151 message(STATUS "Configuration types: ${CMAKE_CONFIGURATION_TYPES}")
152 string(TOUPPER "${CMAKE_BUILD_TYPE}" _build_type)
153 message(STATUS "CMAKE_C_FLAGS_${_build_type}: ${CMAKE_C_FLAGS_${_build_type}}")
154 message(STATUS "CMAKE_CXX_FLAGS_${_build_type}: ${CMAKE_CXX_FLAGS_${_build_type}}")
156 # Where to put executables and libraries in the build tree
157 # Note: Executables and libraries might end end up in a configuration
158 # subdirectory, e.g. run/Debug or run/Release. We try to set DATAFILE_DIR
159 # to a corresponding value below.
160 if(NOT ARCHIVE_OUTPUT_PATH)
161 set(ARCHIVE_OUTPUT_PATH ${Wireshark_BINARY_DIR}/run CACHE INTERNAL
162 "Single output directory for building all archives.")
164 if(NOT EXECUTABLE_OUTPUT_PATH)
165 set(EXECUTABLE_OUTPUT_PATH ${Wireshark_BINARY_DIR}/run CACHE INTERNAL
166 "Single output directory for building all executables.")
168 if(NOT LIBRARY_OUTPUT_PATH)
169 set(LIBRARY_OUTPUT_PATH ${Wireshark_BINARY_DIR}/run CACHE INTERNAL
170 "Single output directory for building all libraries.")
173 # Under linux the release mode (CMAKE_BUILD_TYPE=release) defines NDEBUG
174 #Defines CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_DATADIR, etc ...
175 include(CMakeInstallDirs)
177 # Updated by make-version.pl
179 set(PROJECT_MAJOR_VERSION 2)
180 set(PROJECT_MINOR_VERSION 1)
181 set(PROJECT_PATCH_VERSION 0)
182 set(PROJECT_BUILD_VERSION ${GIT_REVISION})
183 set(PROJECT_VERSION_EXTENSION "$ENV{WIRESHARK_VERSION_EXTRA}")
184 set(PROJECT_VERSION "${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}${PROJECT_VERSION_EXTENSION}")
186 # Banner shown at top right of Qt welcome screen.
187 if(DEFINED ENV{WIRESHARK_VERSION_FLAVOR})
188 set(VERSION_FLAVOR "$ENV{WIRESHARK_VERSION_FLAVOR}")
190 set(VERSION_FLAVOR "Development Build")
193 # These are required in .rc files and manifests
194 set(VERSION_MAJOR ${PROJECT_MAJOR_VERSION})
195 set(VERSION_MINOR ${PROJECT_MINOR_VERSION})
196 set(VERSION_MICRO ${PROJECT_PATCH_VERSION})
197 set(VERSION_BUILD ${PROJECT_BUILD_VERSION})
198 set(RC_VERSION ${PROJECT_MAJOR_VERSION},${PROJECT_MINOR_VERSION},${PROJECT_PATCH_VERSION},${PROJECT_BUILD_VERSION})
200 message(STATUS "V: ${PROJECT_VERSION}, MaV: ${PROJECT_MAJOR_VERSION}, MiV: ${PROJECT_MINOR_VERSION}, PL: ${PROJECT_PATCH_VERSION}, EV: ${PROJECT_VERSION_EXTENSION}.")
203 include(UseMakeDissectorReg)
204 include(UseMakeTapReg)
210 ${CMAKE_SOURCE_DIR}/epan
211 ${CMAKE_SOURCE_DIR}/tools/lemon
212 ${CMAKE_SOURCE_DIR}/wiretap
215 include( CMakeOptions.txt )
216 if( DUMPCAP_INSTALL_OPTION STREQUAL "suid" )
217 set( DUMPCAP_SETUID "SETUID" )
219 set( DUMPCAP_SETUID )
221 if( NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND
222 DUMPCAP_INSTALL_OPTION STREQUAL "capabilities" )
223 message( WARNING "Capabilities are only supported on Linux" )
224 set( DUMPCAP_INSTALL_OPTION )
227 # Always enable position-independent code when compiling, even for
228 # executables, so you can build position-independent executables.
229 # -pie is added below for non-MSVC.
230 # Needed when either:
231 # - Qt5_POSITION_INDEPENDENT_CODE is set and CMake < 2.8.11
232 # - PIE is wanted (-pie) and you want to add -fPIC/-fPIE automatically.
233 # This option only has an effect on CMake >= 2.8.9
234 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
236 if( CMAKE_C_COMPILER_ID MATCHES "MSVC")
238 set(MSC_VER_REQUIRED 1600)
240 set(MSC_VER_REQUIRED 1700)
242 set(MSC_VER_REQUIRED 1800)
244 set(MSC_VER_REQUIRED 1900)
246 message(FATAL_ERROR "You are using an unsupported version of MSVC")
250 /DWIN32_LEAN_AND_MEAN
251 "/DMSC_VER_REQUIRED=${MSC_VER_REQUIRED}"
252 /D_CRT_SECURE_NO_DEPRECATE
253 /D_CRT_NONSTDC_NO_DEPRECATE
254 # NOMINMAX keeps windows.h from defining "min" and "max" via windef.h.
255 # This avoids conflicts with the C++ standard library.
257 # -DPSAPI_VERSION=1 Programs that must run on earlier versions of Windows as well as Windows 7 and later
258 # versions should always call this function as GetProcessMemoryInfo. To ensure correct
259 # resolution of symbols, add Psapi.lib to the TARGETLIBS macro and compile the program
260 # with -DPSAPI_VERSION=1.To use run-time dynamic linking, load Psapi.dll.
261 # http://msdn.microsoft.com/en-us/library/windows/desktop/ms683219(v=vs.85).aspx
262 # -DBUILD_WINDOWS Starting from VS2013, GetVersionEx is deprecated and we are recommended to use
263 # VerifyVersionInfo instead
264 # http://msdn.microsoft.com/en-us/library/windows/desktop/ms724429(v=vs.85).aspx
265 # http://msdn.microsoft.com/en-us/library/windows/desktop/ms725491(v=vs.85).aspx
266 # To continue to use GetVersionEx, we can define BUILD_WINDOWS
267 # -D_ALLOW_KEYWORD_MACROS For VS2012 onwards the, C++ STL does not permit macro redefinitions of keywords
268 # (see http://msdn.microsoft.com/en-us/library/bb531344(v=vs.110).aspx)
269 # This definition prevents the complaint about the redefinition of inline by WinPCap
270 # in pcap-stdinc.h when compiling CPP files, e.g. the Qt UI
273 /D_ALLOW_KEYWORD_MACROS
276 if(NOT "${WIRESHARK_TARGET_PLATFORM}" STREQUAL "win64")
277 add_definitions("/D_BIND_TO_CURRENT_CRT_VERSION=1")
280 # FIXME: WINPCAP_VERSION cannot be determined from source or executable.
281 set(WINPCAP_VERSION "4_1_3")
282 add_definitions("/DWINPCAP_VERSION=${WINPCAP_VERSION}")
289 # /Zo Enhanced debugging of optimised code for VS2013 Update 3 and beyond,
290 # Assume all VS2013 builds are at least Update 3.
291 # See http://msdn.microsoft.com/en-us/library/dn785163.aspx
292 set(LOCAL_CFLAGS ${LOCAL_CFLAGS} "/Zo")
294 # /Zo Enhanced debugging of optimised code
295 # VS2015(MSVC14): On by default when /Zi or /Z7 used.
296 set(LOCAL_CFLAGS ${LOCAL_CFLAGS} "/Zo")
299 if(ENABLE_CODE_ANALYSIS)
300 set(LOCAL_CFLAGS ${LOCAL_CFLAGS} "/analyze:WX-")
303 # Additional compiler warnings to be treated as "Level 3"
304 # when compiling Wireshark sources. (Selected from "level 4" warnings).
305 ## 4295: array is too small to include a terminating null character
306 ## 4189: local variable is initialized but not referenced
307 set(WARNINGS_CFLAGS "/w34295 /w34189")
309 set(WIRESHARK_COMMON_FLAGS
314 # Set in Makefile.nmake
315 set(WS_LINK_FLAGS "/LARGEADDRESSAWARE /MANIFEST:NO /INCREMENTAL:NO /RELEASE")
318 if(CMAKE_OSX_DEPLOYMENT_TARGET)
320 if(${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.0")
321 message(FATAL_ERROR "We don't support building for OS X 10.0")
322 elseif(${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.1")
323 message(FATAL_ERROR "We don't support building for OS X 10.1")
324 elseif(${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.2")
325 message(FATAL_ERROR "We don't support building for OS X 10.2")
326 elseif(${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.4" OR ${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.5")
328 # Only 32-bit builds are supported. 10.5
329 # (and 10.4?) had a bug that causes some BPF
330 # functions not to work with 64-bit userland
331 # code, so capturing won't work.
333 set(CMAKE_C_FLAGS "-m32 ${CMAKE_C_FLAGS}")
334 set(CMAKE_CXX_FLAGS "-m32 ${CMAKE_CXX_FLAGS}")
335 set(WS_LINK_FLAGS "-m32 ${WS_LINK_FLAGS}")
337 message(STATUS "Building for OS X ${CMAKE_OSX_DEPLOYMENT_TARGET}")
339 message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET only applies when building for OS X")
343 set(WIRESHARK_COMMON_FLAGS
344 # The following are for C and C++
345 # -O<X> and -g get set by the CMAKE_BUILD_TYPE
361 -Wno-overlength-strings
364 -Wunused-const-variable
367 set(WIRESHARK_C_ONLY_FLAGS
368 # The following are C only, not C++
370 -Wdeclaration-after-statement
373 -Wold-style-definition
377 # The Qt headers generate a ton of shortening errors on 64-bit systems
378 # so only enable this for C for now.
382 set(WIRESHARK_CPP_ONLY_FLAGS
385 set(WIRESHARK_EXTRA_COMPILER_COMMON_FLAGS
386 # The following are for C and C++
389 # As we use variadic macros, we don't want warnings
390 # about them, even with -Wpedantic.
394 # Various code blocks this one.
397 -fstrict-overflow -Wstrict-overflow=4
399 # Due to various places where APIs we don't control
400 # require us to cast away constness, we can probably
401 # never enable this one with -Werror.
405 # Some generated ASN.1 dissectors block this one;
406 # multiple function declarations for the same
407 # function are being generated.
411 # Some loops are safe, but it's hard to convince the
414 -Wunsafe-loop-optimizations
416 # All the registration functions block these for now.
419 -Wmissing-declarations
421 # A bunch of "that might not work on SPARC" code blocks
426 # Works only with Clang
430 # Works only with Clang but generates a lot of warnings
431 # (about glib library not using Doxygen)
435 # No longer supported by El Capitan clang on C++
437 -fno-delete-null-pointer-checks
440 set(WIRESHARK_EXTRA_COMPILER_C_ONLY_FLAGS
441 # The following are C only, not C++
443 # Due to various places where APIs we don't control
444 # require us to cast away constness, we can probably
445 # never enable this one with -Werror.
450 set(WIRESHARK_EXTRA_COMPILER_CPP_ONLY_FLAGS
453 if(CMAKE_C_COMPILER_ID MATCHES "Clang")
454 set(WIRESHARK_COMMON_FLAGS ${WIRESHARK_COMMON_FLAGS}
455 # avoid "argument unused during compilation" warnings
456 # (for example, when getting the -gsplit-dwarf option or
457 # when combining -fwrapv with -fno-strict-overflow)
461 set(WIRESHARK_CPP_ONLY_FLAGS ${WIRESHARK_CPP_ONLY_FLAGS}
464 set(WIRESHARK_COMMON_FLAGS ${WIRESHARK_COMMON_FLAGS}
465 -fexcess-precision=fast
468 set(WIRESHARK_C_ONLY_FLAGS ${WIRESHARK_C_ONLY_FLAGS}
472 set(WIRESHARK_ASAN_FLAGS
473 # With Clang >= 3.5 Leak detection is enable by default
474 # and no yet all leak is fixed...
475 # use ASAN_OPTIONS=detect_leaks=0 to disable detect_leaks
477 -fsanitize=undefined # compile and runtime checks
478 # -fsanitize=float-divide-by-zero
479 # -fsanitize=float-cast-overflow
480 # -fno-sanitize-recover # Abort during runtime
484 set(WIRESHARK_COMMON_FLAGS ${WIRESHARK_COMMON_FLAGS} ${WIRESHARK_ASAN_FLAGS})
487 if(ENABLE_EXTRA_COMPILER_WARNINGS) # This overrides -Werror
488 set(WIRESHARK_COMMON_FLAGS ${WIRESHARK_COMMON_FLAGS} ${WIRESHARK_EXTRA_COMPILER_COMMON_FLAGS})
489 set(WIRESHARK_C_ONLY_FLAGS ${WIRESHARK_C_ONLY_FLAGS} ${WIRESHARK_EXTRA_COMPILER_C_ONLY_FLAGS})
490 set(WIRESHARK_CPP_ONLY_FLAGS ${WIRESHARK_CPP_ONLY_FLAGS} ${WIRESHARK_EXTRA_COMPILER_CPP_ONLY_FLAGS})
494 -DG_DISABLE_DEPRECATED
495 -DG_DISABLE_SINGLE_INCLUDES
499 set( C_FLAG_TESTS ${WIRESHARK_COMMON_FLAGS} ${WIRESHARK_C_ONLY_FLAGS} )
500 set( CPP_FLAG_TESTS ${WIRESHARK_COMMON_FLAGS} ${WIRESHARK_CPP_ONLY_FLAGS} )
502 # Counterhack to work around some cache magic in CHECK_C_SOURCE_COMPILES
503 include(CheckCCompilerFlag)
504 include(CheckCXXCompilerFlag)
507 set(BUILD_SHARED_LIBS 0)
508 set(LINK_MODE_LIB STATIC)
509 set(LINK_MODE_MODULE STATIC)
511 set(BUILD_SHARED_LIBS 1)
512 set(LINK_MODE_LIB SHARED)
513 set(LINK_MODE_MODULE MODULE)
516 # Sigh: Have to use THIS_FLAG instead of ${F} for some reason
517 foreach(THIS_FLAG ${C_FLAG_TESTS})
518 string( REGEX REPLACE "[^a-zA-Z0-9_]+" "_" F ${THIS_FLAG} )
519 set(${F} ${THIS_FLAG})
521 message(STATUS "Checking for c-compiler flag: ${THIS_FLAG}")
522 check_c_compiler_flag("${ADDED_CMAKE_C_FLAGS} ${${F}}" ${V})
524 set(ADDED_CMAKE_C_FLAGS "${ADDED_CMAKE_C_FLAGS} ${${F}}")
527 set(CMAKE_C_FLAGS "${ADDED_CMAKE_C_FLAGS} ${CMAKE_C_FLAGS}")
529 foreach(THIS_FLAG ${CPP_FLAG_TESTS})
530 string( REGEX REPLACE "[^a-zA-Z0-9_]+" "_" F ${THIS_FLAG} )
531 set(${F} ${THIS_FLAG})
532 set(V CPP_${F}_VALID)
533 message(STATUS "Checking for c++-compiler flag: ${THIS_FLAG}")
534 check_cxx_compiler_flag("${ADDED_CMAKE_CXX_FLAGS} ${${F}}" ${V})
536 set(ADDED_CMAKE_CXX_FLAGS "${ADDED_CMAKE_CXX_FLAGS} ${${F}}")
539 set(CMAKE_CXX_FLAGS "${ADDED_CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
541 if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_COMPILER_WARNINGS)
542 if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
543 set(WERROR_COMMON_FLAGS "/WX")
544 set(NO_ERROR_DEPRECATED_DECLARATIONS_COMPILE_FLAGS)
546 check_c_compiler_flag(-Werror WERROR)
548 set(WERROR_COMMON_FLAGS "-Werror")
549 set(NO_ERROR_DEPRECATED_DECLARATIONS_COMPILE_FLAGS "-Wno-error=deprecated-declarations")
553 set(WERROR_COMMON_FLAGS FALSE)
557 # Try to have the compiler default to hiding symbols, so that only
558 # symbols explicitly exported with WS_DLL_PUBLIC will be visible
559 # outside (shared) libraries; that way, more UN*X builds will catch
560 # failures to export symbols, rather than having that fail only on
563 # We don't need that with MSVC, as that's the default.
565 if( NOT CMAKE_C_COMPILER_ID MATCHES "MSVC")
567 # Try the GCC-and-compatible -fvisibility-hidden first.
569 check_c_compiler_flag(-fvisibility=hidden FVHIDDEN)
571 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
574 # OK, try the Sun^WOracle C -xldscope=hidden
576 check_c_compiler_flag(-xldscope=hidden XLDSCOPEHIDDEN)
578 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -xldscope=hidden")
582 # If there is anything else, we might want to
583 # make a list of options to try, and try them
586 message(WARNING "Hiding shared library symbols is not supported by the compiler."
587 " All shared library symbols will be exported.")
592 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
593 set (C_UNUSED "__attribute__((unused))" )
599 # XXX - at least with the Visual Studio 12 generator, this would test
600 # whether the flag works with the compiler, but, at least when building
601 # for Win64, the flag "works", in that the link succeeds, but with a
602 # warning of an unused linker argument.
604 # So we leave it out for now; maybe there's a way to force the linker to
605 # fail with unknown arguments, or maybe we have to look for error
606 # messages in the linker output, the way CHECK_C_COMPILER_FLAG does.
608 if(NOT CMAKE_C_COMPILER_ID MATCHES "MSVC")
609 set(WIRESHARK_LD_FLAGS
615 # CMAKE_POSITION_INDEPENDENT_CODE is only supported starting with CMake
616 # 2.8.9. Do not add -pie automatically for older versions.
618 # XXX - are there other compilers that don't support -pie? It's
619 # not as if the only platforms we support are Windows and Linux....
621 if(NOT CMAKE_VERSION VERSION_LESS "2.8.9")
622 set(WIRESHARK_LD_FLAGS ${WIRESHARK_LD_FLAGS}
628 include(CheckCLinkerFlag)
630 # Sigh: Have to use THIS_FLAG instead of ${F} for some reason
631 foreach(THIS_FLAG ${WIRESHARK_LD_FLAGS})
632 set(F WS_LD_FLAG_${_C})
633 set(${F} ${THIS_FLAG})
634 set(V WS_LD_FLAG_VALID${_C})
635 check_c_linker_flag(${${F}} ${V})
637 set(WS_LINK_FLAGS "${WS_LINK_FLAGS} ${${F}}")
639 math(EXPR _C "${_C} + 1")
642 if(APPLE AND EXISTS /usr/local/opt/gettext)
643 # GLib on OS X requires libintl. Homebrew installs gettext (and
644 # libintl) in /usr/local/opt/gettext
645 include_directories(/usr/local/opt/gettext/include)
646 link_directories(/usr/local/opt/gettext/lib)
649 # The packagelist is doing some magic: If we add XXX to the packagelist, we
650 # - may optionally set XXX_OPTIONS to pass to the find_package command
651 # - will call FindXXX.cmake
652 # - return found libraries in XXX_LIBRARIES
653 # - return found include in XXX_INCLUDE_DIRS
656 #The minimum package list
657 set(PACKAGELIST Gettext M GLIB2 GMODULE2 GTHREAD2 LEX YACC Perl SED SH PythonInterp)
658 set(LEX_REQUIRED TRUE)
659 set(GLIB2_REQUIRED TRUE)
660 set(GLIB2_FIND_REQUIRED TRUE)
661 set(GLIB2_MIN_VERSION 2.14.0)
662 set(GTHREAD2_REQUIRED TRUE)
663 set(PythonInterp_FIND_VERSION 2)
664 set(Python_ADDITIONAL_VERSIONS 3)
665 set(YACC_REQUIRED TRUE)
671 set(PACKAGELIST ${PACKAGELIST} HtmlViewer)
673 set(PACKAGELIST ${PACKAGELIST} LIBSSH)
674 set(LIBSSH_OPTIONS "0.6")
677 set(PACKAGELIST ${PACKAGELIST} PCAP)
681 set(PACKAGELIST ${PACKAGELIST} AIRPCAP)
685 if(BUILD_wireshark_gtk)
687 set(PACKAGELIST ${PACKAGELIST} GTK3)
689 set(PACKAGELIST ${PACKAGELIST} GTK2)
690 set(GTK2_OPTIONS COMPONENTS gtk)
691 set(GTK2_FIND_VERSION 2.12)
692 set(GTK2_DEBUG false)
699 # Untested, may not work if CMAKE_PREFIX_PATH gets overwritten
700 # somewhere. The if WIN32 in this place is annoying as well.
702 set( QT5_BASE_PATH "$ENV{QT5_BASE_DIR}" )
703 set( CMAKE_PREFIX_PATH "${QT5_BASE_PATH}" )
705 set(PACKAGELIST ${PACKAGELIST}
714 set(PACKAGELIST ${PACKAGELIST} Qt5MacExtras)
717 set(PACKAGELIST ${PACKAGELIST} Qt5WinExtras)
721 set(PACKAGELIST ${PACKAGELIST} Qt4)
722 set(Qt4_OPTIONS 4.7.1 REQUIRED QtCore QtGui)
729 set(PACKAGELIST ${PACKAGELIST} SMI)
734 set(PACKAGELIST ${PACKAGELIST} GCRYPT)
735 # Minimum version needed.
736 set(GCRYPT_OPTIONS "1.4.2")
739 # GNU SSL/TLS support
741 set(PACKAGELIST ${PACKAGELIST} GNUTLS)
742 # Minimum version needed.
743 set(GNUTLS_OPTIONS "2.12.0")
748 set(PACKAGELIST ${PACKAGELIST} KERBEROS)
751 # Portable audio (GTK+ only)
752 if(ENABLE_PORTAUDIO AND BUILD_wireshark_gtk)
753 set(PACKAGELIST ${PACKAGELIST} PORTAUDIO)
757 # Prefer c-ares over adns
758 if(ENABLE_CARES) # C Asynchronouse resolver
759 set(PACKAGELIST ${PACKAGELIST} CARES)
760 elseif(ENABLE_ADNS) # Gnu asynchronous DNS
761 set(PACKAGELIST ${PACKAGELIST} ADNS)
767 # On Windows we build our own version of zlib, so add the paths
768 set(ZLIB_SRC_DIR "${_PROJECT_LIB_DIR}/zlib-1.2.8-ws")
769 set(SKIP_INSTALL_ALL True) # We copy the DLL ourselves.
770 add_subdirectory("${ZLIB_SRC_DIR}" "${CMAKE_BINARY_DIR}/zlib")
771 unset(SKIP_INSTALL_ALL)
772 set(ZLIB_INCLUDE_DIR "${ZLIB_SRC_DIR}" "${CMAKE_BINARY_DIR}/zlib")
773 set(ZLIB_LIBRARY zlib)
774 set(ZLIB_DLL "zlib1.dll")
775 set_target_properties(zlib PROPERTIES FOLDER "Libs/zlib")
776 # Annoyingly zlib also builds some other stuff we aren't interested in
777 set_target_properties(zlibstatic PROPERTIES FOLDER "Libs/zlib")
779 set(PACKAGELIST ${PACKAGELIST} ZLIB)
782 # Embedded Lua interpreter
784 set(PACKAGELIST ${PACKAGELIST} LUA)
787 # GeoIP address resolving
789 set(PACKAGELIST ${PACKAGELIST} GEOIP)
793 set(PACKAGELIST ${PACKAGELIST} NL)
797 set(PACKAGELIST ${PACKAGELIST} SBC)
802 set(PACKAGELIST ${PACKAGELIST} CAP SETCAP)
805 # Windows version updates
806 if(ENABLE_WINSPARKLE)
807 set(PACKAGELIST ${PACKAGELIST} WINSPARKLE)
810 set(PACKAGELIST ${PACKAGELIST} YAPP)
812 set(PACKAGELIST ${PACKAGELIST} POD)
814 if(ENABLE_HTML_GUIDES)
815 set(PACKAGELIST ${PACKAGELIST} DOXYGEN)
820 # Sort the package list
821 list(SORT PACKAGELIST)
822 message(STATUS "Packagelist: ${PACKAGELIST}")
823 # Let's loop the package list
824 foreach(PACKAGE ${PACKAGELIST})
825 if(${PACKAGE} STREQUAL "Qt4")
826 set(PACKAGE_VAR "QT")
827 elseif(${PACKAGE} STREQUAL "PythonInterp")
828 set(PACKAGE_VAR "PYTHONINTERP")
829 elseif(${PACKAGE} STREQUAL "Gettext")
830 set(PACKAGE_VAR "GETTEXT")
831 elseif(${PACKAGE} STREQUAL "HtmlViewer")
832 set(PACKAGE_VAR "HTML_VIEWER")
833 elseif(${PACKAGE} STREQUAL "Perl")
834 set(PACKAGE_VAR "PERL")
836 set(PACKAGE_VAR ${PACKAGE})
838 if(${PACKAGE}_OPTIONS)
839 find_package(${PACKAGE} ${${PACKAGE}_OPTIONS})
840 elseif(${PACKAGE}_REQUIRED)
841 find_package(${PACKAGE} REQUIRED)
843 find_package(${PACKAGE})
845 if (${PACKAGE_VAR}_FOUND)
846 message(STATUS "${PACKAGE_VAR} FOUND")
847 set(HAVE_LIB${PACKAGE_VAR} 1)
848 include_directories(SYSTEM ${${PACKAGE_VAR}_INCLUDE_DIRS})
849 set(WS_ALL_LIBS ${WS_ALL_LIBS} ${${PACKAGE_VAR}_LIBRARIES})
850 message(STATUS "${PACKAGE} includes: ${${PACKAGE_VAR}_INCLUDE_DIRS}")
851 message(STATUS "${PACKAGE} libs: ${${PACKAGE_VAR}_LIBRARIES}")
852 if (${PACKAGE}_DEFINITIONS)
853 message(STATUS "${PACKAGE} definitions: ${${PACKAGE_VAR}_DEFINITIONS}")
855 if (${PACKAGE_VAR}_EXECUTABLE)
856 message(STATUS "${PACKAGE} executable: ${${PACKAGE_VAR}_EXECUTABLE}")
860 # Not finding a package is only a fatal error if the
861 # package is required; if it's required, then its
862 # XXX_REQUIRED variable is set to TRUE, and the above
863 # code will pass REQUIRED to find_package, and the
864 # configure will fail if the package isn't found.
866 # Do *NOT* report this as an error!
868 message(STATUS "${PACKAGE_VAR} NOT FOUND")
872 # Provide Windows system lib names
873 include( UseWinLibs )
876 include(CPackConfig.txt)
900 if(HAVE_LIBNL AND HAVE_AIRPCAP)
901 message(ERROR "Airpcap and Libnl support are mutually exclusive")
906 if(EXTCAP_ANDROIDDUMP_LIBPCAP)
907 set(ANDROIDDUMP_USE_LIBPCAP 1)
910 if (HAVE_LIBWINSPARKLE)
911 set(HAVE_SOFTWARE_UPDATE 1)
914 # No matter which version of GTK is present
915 if(GTK2_FOUND OR GTK3_FOUND)
918 # That's the name autofoo uses
921 # Always include the "true" zlib includes first. This works around a
922 # bug in the Windows setup of GTK[23] which has a faulty zconf.h.
923 include_directories(BEFORE ${ZLIB_INCLUDE_DIRS})
925 if (Qt5Widgets_FOUND)
927 # Qt5CoreConfigExtras.cmake in Qt 5.5.0 sets -fPIC unconditionally:
929 # https://bugreports.qt.io/browse/QTBUG-47942
931 # There's a fix in Gerrit for that:
933 # https://codereview.qt-project.org/#/c/139645/
935 # Do the same check as that fix does and, if the check says we
936 # should *not* add -fPIC, remove it.
938 # XXX - if that check gets changed in the future, we'll have to
939 # detect that and change it.
941 if (CMAKE_VERSION VERSION_LESS 2.8.12
942 AND (CMAKE_CXX_COMPILER_ID STREQUAL \"GNU\"
943 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))
945 # Yes, it should have been; leave it there.
949 # No, it shouldn't have been; remove it.
951 list(REMOVE_ITEM Qt5Widgets_EXECUTABLE_COMPILE_FLAGS "-fPIC")
953 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
955 set (QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES})
956 if(Qt5Multimedia_FOUND)
957 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5Multimedia_LIBRARIES})
958 # That's the name autofoo uses
959 set(QT_MULTIMEDIA_LIB 1)
962 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5Svg_LIBRARIES})
963 # That's the name autofoo uses
966 if(Qt5MacExtras_FOUND)
967 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5MacExtras_LIBRARIES})
968 # That's the name autofoo uses
969 set(QT_MACEXTRAS_LIB 1)
971 if(Qt5WinExtras_FOUND)
972 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5WinExtras_LIBRARIES})
973 # set(QT_WINEXTRAS_LIB 1) # Not needed?
975 # If Qt4: QT_LIBRARIES and QT_INCLUDES are not set above. They require extra magic
977 include(${QT_USE_FILE})
978 include_directories(${QT_INCLUDE_DIR})
979 message(STATUS "Qt includes: ${QT_INCLUDE_DIR}")
980 message(STATUS "Qt libs: ${QT_LIBRARIES}")
981 if(QT_QTMULTIMEDIA_FOUND)
982 include_directories(${QT_QTMULTIMEDIA_INCLUDE_DIR})
983 message(STATUS "QtMultimedia includes: ${QT_INCLUDE_DIR}")
984 set (QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMULTIMEDIA_LIBRARY})
985 message(STATUS "QtMultimedia libs: ${QT_QTMULTIMEDIA_LIBRARY}")
986 # That's the name autofoo uses
987 set(QT_MULTIMEDIA_LIB 1)
991 message(STATUS "C-Flags: ${CMAKE_C_FLAGS}")
992 message(STATUS "CXX-Flags: ${CMAKE_CXX_FLAGS}")
993 message(STATUS "Warnings as errors: ${WERROR_COMMON_FLAGS}")
997 # We assume that APPLE means OS X so that we have the OS X
1000 set(HAVE_OS_X_FRAMEWORKS 1)
1001 FIND_LIBRARY (APPLE_APPLICATION_SERVICES_LIBRARY ApplicationServices)
1002 FIND_LIBRARY (APPLE_CORE_FOUNDATION_LIBRARY CoreFoundation)
1003 FIND_LIBRARY (APPLE_SYSTEM_CONFIGURATION_LIBRARY SystemConfiguration)
1006 include(ConfigureChecks.cmake)
1008 #Big or little endian ?
1009 include(TestBigEndian)
1010 test_big_endian(WORDS_BIGENDIAN)
1012 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
1014 add_subdirectory( asn1 EXCLUDE_FROM_ALL )
1015 add_subdirectory( capchild )
1016 add_subdirectory( caputils )
1017 add_subdirectory( codecs )
1018 add_subdirectory( docbook )
1019 add_subdirectory( epan )
1020 add_subdirectory( tools/lemon )
1021 add_subdirectory( ui )
1022 add_subdirectory( wiretap )
1023 add_subdirectory( wsutil )
1026 add_custom_target(dumpabi DEPENDS dumpabi-libwireshark dumpabi-libwiretap dumpabi-libwsutil)
1030 add_subdirectory( echld )
1033 if(BUILD_wireshark_gtk AND GTK_FOUND)
1034 add_subdirectory( ui/gtk )
1037 if(BUILD_wireshark AND QT_FOUND)
1038 add_subdirectory( ui/qt )
1041 # Location of our data files. This should be set to a value that allows
1042 # running from the build directory on Windows, on OS X when building an
1043 # application bundle, and on UNIX if WIRESHARK_RUN_FROM_BUILD_DIRECTORY
1045 if(ENABLE_APPLICATION_BUNDLE)
1046 set(_datafile_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Resources/share/wireshark")
1048 get_target_property(_libwireshark_location epan LOCATION)
1049 get_filename_component(_datafile_dir "${_libwireshark_location}" PATH)
1052 set(DATAFILE_DIR ${_datafile_dir} CACHE INTERNAL "Build time data file location.")
1055 # Target platform locations
1056 # UNIX, Linux, non-bundled OS X: $DESTDIR/lib/wireshark/extcap
1057 # Windows: $DESTDIR/extcap
1058 # OS X app bundle: Wireshark.app/Contents/Resources/share/wireshark/extcap
1061 set(EXTCAP_DIR "extcap")
1063 set(EXTCAP_DIR "${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/extcap")
1068 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LIBSSH_LIBRARIES})
1069 CHECK_FUNCTION_EXISTS(ssh_userauth_agent LIBSSH_USERAUTH_AGENT_FOUND)
1070 if(LIBSSH_USERAUTH_AGENT_FOUND)
1071 set(HAVE_SSH_USERAUTH_AGENT 1)
1075 # Location of our plugins. PLUGIN_DIRECTORY should allow running
1076 # from the build directory similar to DATAFILE_DIR above.
1078 # Target platform locations
1079 # UNIX, Linux, non-bundled OS X: $DESTDIR/lib/wireshark/plugins/$VERSION
1080 # Windows: $DESTDIR/wireshark/plubins/$VERSION
1081 # OS X app bundle: Wireshark.app/Contents/PlugIns/wireshark
1083 add_custom_target(plugins)
1084 set_target_properties(plugins PROPERTIES FOLDER "Plugins")
1086 set(PLUGIN_INSTALL_DIR "plugins/${CPACK_PACKAGE_VERSION}")
1088 set(PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}")
1104 ${CUSTOM_PLUGIN_SRC_DIR}
1106 # It seems this stuff doesn't build with autofoo either...
1108 # set(PLUGIN_SRC_DIRS
1109 # ${PLUGIN_SRC_DIRS}
1114 set(PLUGIN_SRC_DIRS )
1117 if(ENABLE_APPLICATION_BUNDLE)
1118 set(_plugin_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/PlugIns/wireshark")
1120 get_target_property(_libwireshark_location epan LOCATION)
1121 get_filename_component(_plugin_dir "${_libwireshark_location}" PATH)
1122 set(_plugin_dir "${_plugin_dir}/plugins")
1124 # XXX The NMake environment appends the version. Should we do so here?
1125 set (PLUGIN_DIR ${_plugin_dir} CACHE INTERNAL "Build time plugin location.")
1127 foreach(_plugin_src_dir ${PLUGIN_SRC_DIRS})
1128 add_subdirectory( ${_plugin_src_dir} )
1132 # Basedir where to install guides
1133 set(DOC_DIR "$ENV{docdir}" CACHE FILEPATH "Installation directory for ug and dg pdfs.")
1134 message(STATUS "docdir: ${DOC_DIR}")
1136 if(ENABLE_PCAP_NG_DEFAULT)
1137 set(PCAP_NG_DEFAULT 1)
1140 # Large file support (e.g. make off_t 64 bit if supported)
1141 include(gmxTestLargeFiles)
1142 gmx_test_large_files(GMX_LARGEFILES)
1144 add_definitions( -DTOP_SRCDIR=\"${CMAKE_SOURCE_DIR}\" )
1147 set(WS_MSVC_NORETURN "__declspec(noreturn)")
1149 # Disable deprecation
1150 if(MSVC80 OR MSVC90)
1151 add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
1154 set(WS_MSVC_NORETURN " ")
1157 set( VERSION ${PROJECT_VERSION} )
1159 COMMAND ${PERL_EXECUTABLE}
1160 ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
1162 ${CMAKE_CURRENT_SOURCE_DIR}
1163 OUTPUT_VARIABLE VERSION_H_CONTENT
1165 set( configure_input "Built with CMake ${CMAKE_VERSION}" )
1166 configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h)
1167 configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_BINARY_DIR}/version.h)
1168 #set_target_properties(${CMAKE_BINARY_DIR}/version.h PROPERTIES FOLDER "Auxiliary")
1170 set( prefix "${CMAKE_INSTALL_PREFIX}" )
1171 set( exec_prefix "\${prefix}" )
1172 set( libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}" )
1173 set( includedir "\${prefix}/include" )
1174 set( plugindir "\${libdir}/wireshark/plugins/${CPACK_PACKAGE_VERSION}" )
1176 set(ICON_PATH "${CMAKE_SOURCE_DIR}/image/")
1179 capchild/doxygen.cfg.in
1180 caputils/doxygen.cfg.in
1184 image/libwireshark.rc.in
1185 image/text2pcap.rc.in
1186 image/capinfos.rc.in
1187 image/wireshark.rc.in
1188 image/mergecap.rc.in
1191 image/reordercap.rc.in
1192 image/rawshark.rc.in
1193 image/file_dlg_win32.rc
1197 image/libwscodecs.rc.in
1198 image/libwsutil.rc.in
1200 image/wireshark.exe.manifest.in
1201 packaging/macosx/Info.plist.in
1202 packaging/macosx/osx-dmg.sh.in
1203 packaging/macosx/Wireshark_package.pmdoc/index.xml.in
1205 ui/gtk/doxygen.cfg.in
1206 ui/qt/doxygen.cfg.in
1209 foreach( _in_file ${IN_FILES} )
1210 get_filename_component( _path ${_in_file} PATH )
1211 string( REGEX REPLACE "(.*)\\.in" "\\1" _outfile ${_in_file} )
1212 configure_file( ${CMAKE_SOURCE_DIR}/${_in_file} ${CMAKE_BINARY_DIR}/${_outfile} @ONLY )
1215 include(FeatureSummary)
1216 #SET_FEATURE_INFO(NAME DESCRIPTION [URL [COMMENT] ])
1217 SET_FEATURE_INFO(SBC "SBC Codec for Bluetooth A2DP stream playing" "www: http://git.kernel.org/cgit/bluetooth/sbc.git" )
1218 SET_FEATURE_INFO(LIBSSH "libssh is library for ssh connections and it is needed to build sshdump" "www: https://www.libssh.org/get-it/" )
1220 FEATURE_SUMMARY(WHAT ALL)
1223 ${CMAKE_BINARY_DIR}/ui
1224 ${CMAKE_BINARY_DIR}/ui/gtk
1225 ${CMAKE_BINARY_DIR}/ui/qt
1226 ${CMAKE_BINARY_DIR}/capchild
1227 ${CMAKE_BINARY_DIR}/caputils
1228 ${CMAKE_BINARY_DIR}/codecs
1229 ${CMAKE_BINARY_DIR}/epan
1230 ${CMAKE_BINARY_DIR}/wiretap
1231 ${CMAKE_BINARY_DIR}/wsutil
1236 ui/win32/console_win32.c
1237 ui/win32/file_dlg_win32.c
1238 ui/win32/print_win32.c
1240 set(PLATFORM_UI_RC_FILES
1241 image/file_dlg_win32.rc
1245 # sources common for wireshark, tshark, and rawshark
1246 set(SHARK_COMMON_SRC
1252 # sources for external capture interfaces
1254 set(SHARK_COMMON_SRC
1262 ui/cli/tap-camelsrt.c
1263 ui/cli/tap-comparestat.c
1264 ui/cli/tap-diameter-avp.c
1266 ui/cli/tap-endpoints.c
1269 ui/cli/tap-gsm_astat.c
1271 ui/cli/tap-httpstat.c
1272 ui/cli/tap-icmpstat.c
1273 ui/cli/tap-icmpv6stat.c
1275 ui/cli/tap-iousers.c
1276 ui/cli/tap-macltestat.c
1277 ui/cli/tap-protocolinfo.c
1278 ui/cli/tap-protohierstat.c
1279 ui/cli/tap-rlcltestat.c
1280 ui/cli/tap-rpcprogs.c
1283 ui/cli/tap-rtspstat.c
1284 ui/cli/tap-sctpchunkstat.c
1285 ui/cli/tap-simple_stattable.c
1286 ui/cli/tap-sipstat.c
1287 ui/cli/tap-smbsids.c
1289 ui/cli/tap-stats_tree.c
1291 ui/cli/tap-wspstat.c
1304 ${CMAKE_BINARY_DIR}/androiddump.html
1305 ${CMAKE_BINARY_DIR}/sshdump.html
1306 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
1307 ${CMAKE_BINARY_DIR}/capinfos.html
1308 ${CMAKE_BINARY_DIR}/captype.html
1312 ${CMAKE_BINARY_DIR}/dftest.html
1313 ${CMAKE_BINARY_DIR}/dumpcap.html
1314 ${CMAKE_BINARY_DIR}/editcap.html
1315 ${CMAKE_BINARY_DIR}/extcap.html
1316 ${CMAKE_BINARY_DIR}/asn2deb.html
1317 ${CMAKE_BINARY_DIR}/idl2deb.html
1318 ${CMAKE_BINARY_DIR}/idl2wrs.html
1321 ${CMAKE_BINARY_DIR}/mergecap.html
1323 ${CMAKE_BINARY_DIR}/randpkt.html
1324 ${CMAKE_BINARY_DIR}/randpktdump.html
1325 ${CMAKE_BINARY_DIR}/rawshark.html
1326 ${CMAKE_BINARY_DIR}/reordercap.html
1329 ${CMAKE_BINARY_DIR}/text2pcap.html
1330 ${CMAKE_BINARY_DIR}/tshark.html
1331 ${CMAKE_BINARY_DIR}/wireshark-filter.html
1332 ${CMAKE_BINARY_DIR}/wireshark.html
1337 set(TEXTIFY_FILES COPYING NEWS README README.windows)
1338 foreach(_text_file ${TEXTIFY_FILES})
1339 set(INSTALL_FILES ${CMAKE_BINARY_DIR}/${_text_file}.txt ${INSTALL_FILES})
1342 set(INSTALL_FILES COPYING ${INSTALL_FILES})
1346 ${CMAKE_BINARY_DIR}/androiddump.1
1347 ${CMAKE_BINARY_DIR}/capinfos.1
1348 ${CMAKE_BINARY_DIR}/captype.1
1349 ${CMAKE_BINARY_DIR}/dftest.1
1350 ${CMAKE_BINARY_DIR}/dumpcap.1
1351 ${CMAKE_BINARY_DIR}/editcap.1
1352 ${CMAKE_BINARY_DIR}/extcap.4
1353 ${CMAKE_BINARY_DIR}/idl2wrs.1
1354 ${CMAKE_BINARY_DIR}/mergecap.1
1355 ${CMAKE_BINARY_DIR}/randpkt.1
1356 ${CMAKE_BINARY_DIR}/androiddump.1
1357 ${CMAKE_BINARY_DIR}/rawshark.1
1358 ${CMAKE_BINARY_DIR}/reordercap.1
1359 ${CMAKE_BINARY_DIR}/sshdump.1
1360 ${CMAKE_BINARY_DIR}/text2pcap.1
1361 ${CMAKE_BINARY_DIR}/tshark.1
1362 ${CMAKE_BINARY_DIR}/wireshark.1
1366 ${CMAKE_BINARY_DIR}/wireshark-filter.4
1370 # @NSL_LIBS@ # -lnsl
1371 # @SOCKET_LIBS@ # -lsocket
1372 # @SSL_LIBS@ # -lcrypto
1374 # $(plugin_ldadd) # in case of static
1375 ${AIRPCAP_LIBRARIES}
1379 ${KERBEROS_LIBRARIES}
1389 ${WINSPARKLE_LIBRARIES}
1393 # According to http://stackoverflow.com/questions/14474659/cmake-how-to-have-a-target-for-copying-files
1394 # we can't just use "set(_dll_output_dir "$<TARGET_FILE_DIR:epan>")"
1395 # DATAFILE_DIR is set using the same property. We could probably
1396 # get away with using it here.
1397 get_target_property(_libwireshark_location epan LOCATION)
1398 get_filename_component(_dll_output_dir "${_libwireshark_location}" PATH)
1399 add_custom_target(copy_cli_dlls)
1400 set_target_properties(copy_cli_dlls PROPERTIES FOLDER "Copy Tasks")
1401 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1402 COMMAND ${CMAKE_COMMAND} -E make_directory "${_dll_output_dir}"
1405 # XXX Can (and should) we iterate over these similar to the way
1406 # the top-level CMakeLists.txt iterates over the package list?
1409 # The cairo, freetype, gio, gnutls, png, and other OBS-generated DLLs
1410 # depend on zlib1.dll. We compile zlib locally but the Debug
1411 # configuration (the default) creates zlibd1.dll.
1412 file (TO_NATIVE_PATH "${_dll_output_dir}" _dll_output_dir_win )
1413 foreach( _dll ${GLIB2_DLLS} $<$<CONFIG:Debug>:zlib1.dll> )
1414 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1415 # It would be really handy if copy, xcopy, or "cmake
1416 # -E copy_if_different" supported multiple files
1417 # separated by whitespace, or if robocpy had a sane
1418 # notion of exit codes.
1419 COMMAND if exist \"${_dll}\" xcopy ${_dll} "${_dll_output_dir_win}" /D /Y
1420 WORKING_DIRECTORY "${GLIB2_DLL_DIR}"
1425 # Don't overwrite an exe if it's already there. We don't want to
1426 # clobber any previous code signing.
1427 file(GLOB _gspawn_helpers
1428 RELATIVE "${GLIB2_DLL_DIR}"
1429 "${GLIB2_DLL_DIR}/gspawn*.exe"
1431 foreach(_gspawn_helper ${_gspawn_helpers})
1432 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1433 COMMAND if not exist \"${_dll_output_dir_win}\\${_gspawn_helper}\" xcopy ${_gspawn_helper} "${_dll_output_dir_win}" /D /Y
1434 WORKING_DIRECTORY "${GLIB2_DLL_DIR}"
1440 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1441 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1442 "${AIRPCAP_DLL_DIR}/${AIRPCAP_DLL}"
1443 "${_dll_output_dir}"
1445 endif(AIRPCAP_FOUND)
1447 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1448 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1449 "${CARES_DLL_DIR}/${CARES_DLL}"
1450 "${_dll_output_dir}"
1454 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1455 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1456 "${GEOIP_DLL_DIR}/${GEOIP_DLL}"
1457 "${_dll_output_dir}"
1461 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1462 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1463 "${LIBSSH_DLL_DIR}/${LIBSSH_DLL}"
1464 "${_dll_output_dir}"
1468 foreach( _dll ${GCRYPT_DLLS} )
1469 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1470 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1471 "${GCRYPT_DLL_DIR}/${_dll}"
1472 "${_dll_output_dir}"
1477 foreach( _dll ${GNUTLS_DLLS} )
1478 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1479 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1480 "${GNUTLS_DLL_DIR}/${_dll}"
1481 "${_dll_output_dir}"
1486 foreach( _dll ${KERBEROS_DLLS} )
1487 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1488 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1489 "${KERBEROS_DLL_DIR}/${_dll}"
1490 "${_dll_output_dir}"
1493 endif(KERBEROS_FOUND)
1495 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1496 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1497 "${LUA_DLL_DIR}/${LUA_DLL}"
1498 "${_dll_output_dir}"
1502 # Wireshark.nsi wants SMI_DIR which is the base SMI directory
1503 get_filename_component(SMI_DIR ${SMI_DLL_DIR} DIRECTORY)
1504 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1505 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1506 "${SMI_DLL_DIR}/${SMI_DLL}"
1507 "${_dll_output_dir}"
1508 COMMAND ${CMAKE_COMMAND} -E make_directory
1509 "${_dll_output_dir}/snmp"
1510 COMMAND ${CMAKE_COMMAND} -E make_directory
1511 "${_dll_output_dir}/snmp/mibs"
1512 COMMAND ${CMAKE_COMMAND} -E copy_directory
1513 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/iana"
1514 "${_dll_output_dir}/snmp/mibs"
1515 COMMAND ${CMAKE_COMMAND} -E copy_directory
1516 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/ietf"
1517 "${_dll_output_dir}/snmp/mibs"
1518 COMMAND ${CMAKE_COMMAND} -E copy_directory
1519 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/irtf"
1520 "${_dll_output_dir}/snmp/mibs"
1521 COMMAND ${CMAKE_COMMAND} -E copy_directory
1522 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/site"
1523 "${_dll_output_dir}/snmp/mibs"
1524 COMMAND ${CMAKE_COMMAND} -E copy_directory
1525 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/tubs"
1526 "${_dll_output_dir}/snmp/mibs"
1527 COMMAND ${CMAKE_COMMAND} -E copy_directory
1528 "${SMI_SHARE_DIR}/${SMI_DLL}/pibs"
1529 "${_dll_output_dir}/snmp/mibs"
1530 COMMAND ${CMAKE_COMMAND} -E copy_directory
1531 "${SMI_SHARE_DIR}/${SMI_DLL}/yang"
1532 "${_dll_output_dir}/snmp/mibs"
1535 if (WINSPARKLE_FOUND)
1536 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1537 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1538 "${WINSPARKLE_DLL_DIR}/${WINSPARKLE_DLL}"
1539 "${_dll_output_dir}"
1541 endif(WINSPARKLE_FOUND)
1543 add_dependencies(epan copy_cli_dlls)
1545 # We have a lot of choices for creating zip archives:
1546 # - 7z, WinZip, etc., which require a separate download+install.
1547 # - Cygwin's zip, which requires Cygwin.
1548 # - "CMake -E tar cz", which creates a tar file.
1549 # - CPack, which requires a CPack configuration.
1550 # - PowerShell via PSCX or System.IO.Compression.FileSystem.
1551 # - Python via zipfile.
1552 # For now, just look for 7z. It's installed on the Windows builders,
1553 # which might be the only systems that use this target.
1554 find_program(ZIP_EXECUTABLE 7z
1555 PATH "$ENV{PROGRAMFILES}/7-Zip" "$ENV{PROGRAMW6432}/7-Zip"
1556 DOC "Path to the 7z utility."
1558 # XXX "if(ZIP_EXECUTABLE)" doesn't work here. It looks like the
1559 # absence of "-NOTFOUND" doesn't equal "true".
1560 if (NOT "${ZIP_EXECUTABLE}" STREQUAL "ZIP_EXECUTABLE-NOTFOUND")
1561 add_custom_target(pdb_zip_package)
1562 set_target_properties(pdb_zip_package PROPERTIES FOLDER "Packaging")
1563 set(_pdb_zip "${CMAKE_BINARY_DIR}/Wireshark-pdb-${WIRESHARK_TARGET_PLATFORM}-${VERSION}.zip")
1564 file(TO_NATIVE_PATH "${_pdb_zip}" _pdb_zip_win)
1565 add_custom_command(TARGET pdb_zip_package POST_BUILD
1566 COMMAND ${CMAKE_COMMAND} -E remove -f "${_pdb_zip}"
1567 COMMAND ${ZIP_EXECUTABLE} a -tzip -mmt=on "${_pdb_zip_win}" *.pdb *.lib
1568 WORKING_DIRECTORY "${_dll_output_dir}"
1570 add_dependencies(pdb_zip_package epan)
1574 # List of extra dependencies for the "copy_data_files" target
1575 set(copy_data_files_depends)
1577 # glob patterns relative to the source directory that should be copied to
1578 # ${DATAFILE_DIR} (including directory prefixes)
1584 foreach(_text_file ${TEXTIFY_FILES})
1585 add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${_text_file}.txt
1586 COMMAND ${POWERSHELL_COMMAND} "${CMAKE_SOURCE_DIR}/tools/textify.ps1"
1587 -Destination ${CMAKE_BINARY_DIR}
1588 ${CMAKE_SOURCE_DIR}/${_text_file}
1590 ${CMAKE_SOURCE_DIR}/${_text_file}
1595 foreach(_install_file ${INSTALL_FILES})
1596 get_filename_component(_install_basename "${_install_file}" NAME)
1597 set(_output_file "${DATAFILE_DIR}/${_install_basename}")
1598 add_custom_command(OUTPUT "${_output_file}"
1599 COMMAND ${CMAKE_COMMAND} -E copy
1602 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
1607 list(APPEND copy_data_files_depends "${_output_file}")
1611 # Ensure "run/extcap" exists
1612 add_custom_command(OUTPUT "${DATAFILE_DIR}/extcap"
1613 COMMAND ${CMAKE_COMMAND} -E make_directory
1614 "${DATAFILE_DIR}/extcap"
1616 list(APPEND copy_data_files_depends "${DATAFILE_DIR}/extcap")
1619 help/capture_filters.txt
1621 help/display_filters.txt
1622 help/getting_started.txt
1626 file(TO_NATIVE_PATH "${DATAFILE_DIR}/help" _help_dest_dir)
1627 foreach(_help_file IN LISTS _help_files)
1628 add_custom_command(OUTPUT "${DATAFILE_DIR}/${_help_file}"
1629 COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/help"
1630 COMMAND ${POWERSHELL_COMMAND} "${CMAKE_SOURCE_DIR}/tools/textify.ps1"
1631 -Destination "${_help_dest_dir}"
1632 "${CMAKE_SOURCE_DIR}/${_help_file}"
1634 "${CMAKE_SOURCE_DIR}/${_help_file}"
1636 list(APPEND copy_data_files_depends "${DATAFILE_DIR}/${_help_file}")
1639 list(APPEND DATA_FILES_SRC ${_help_files})
1642 # Create help/faq.txt when missing
1643 add_custom_command(OUTPUT "${DATAFILE_DIR}/help/faq.txt"
1644 COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/help"
1645 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/help/faq.py -b > faq.tmp.html
1646 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/html2text.py
1647 faq.tmp.html > "${DATAFILE_DIR}/help/faq.txt"
1648 COMMAND ${CMAKE_COMMAND} -E remove faq.tmp.html
1650 "${CMAKE_SOURCE_DIR}/help/faq.py"
1651 "${CMAKE_SOURCE_DIR}/tools/html2text.py"
1653 list(APPEND copy_data_files_depends "${DATAFILE_DIR}/help/faq.txt")
1655 # Install LUA files in staging directory such that LUA can used when Wireshark
1656 # is ran from the build directory. For install targets, see
1657 # epan/wslua/CMakeLists.txt
1658 if(LUA_FOUND AND ENABLE_LUA)
1660 "${CMAKE_BINARY_DIR}/epan/wslua/init.lua"
1661 "${CMAKE_SOURCE_DIR}/epan/wslua/console.lua"
1662 "${CMAKE_SOURCE_DIR}/epan/wslua/dtd_gen.lua"
1664 foreach(_lua_file ${_lua_files})
1665 get_filename_component(_lua_filename "${_lua_file}" NAME)
1666 list(APPEND copy_data_files_depends
1667 "${DATAFILE_DIR}/${_lua_filename}")
1668 add_custom_command(OUTPUT "${DATAFILE_DIR}/${_lua_filename}"
1669 COMMAND ${CMAKE_COMMAND} -E copy
1671 "${DATAFILE_DIR}/${_lua_filename}"
1677 endif(LUA_FOUND AND ENABLE_LUA)
1678 # doc/*.html handled elsewhere.
1680 # TODO shouldn't this use full (relative) paths instead of glob patterns?
1681 list(APPEND DATA_FILES_SRC
1684 "radius/README.radius_dictionary"
1685 "radius/custom.includes"
1687 "radius/dictionary.*"
1697 # Copy all paths from the source tree to the data directory. Directories are
1698 # automatically created if missing as the filename is given.
1699 file(GLOB _data_files RELATIVE "${CMAKE_SOURCE_DIR}" ${DATA_FILES_SRC})
1700 foreach(_data_file ${_data_files})
1701 add_custom_command(OUTPUT "${DATAFILE_DIR}/${_data_file}"
1702 COMMAND ${CMAKE_COMMAND} -E copy
1703 "${CMAKE_SOURCE_DIR}/${_data_file}"
1704 "${DATAFILE_DIR}/${_data_file}"
1706 "${CMAKE_SOURCE_DIR}/${_data_file}"
1708 list(APPEND copy_data_files_depends "${DATAFILE_DIR}/${_data_file}")
1711 # Copy files including ${INSTALL_FILES} and ${INSTALL_DIRS} to ${DATAFILE_DIR}
1712 add_custom_target(copy_data_files ALL DEPENDS ${copy_data_files_depends})
1713 set_target_properties(copy_data_files PROPERTIES FOLDER "Copy Tasks")
1715 if( (BUILD_wireshark AND QT_FOUND) OR (BUILD_wireshark_gtk AND GTK_FOUND) )
1727 ${CMAKE_BINARY_DIR}/image/wireshark.rc
1728 ${PLATFORM_UI_RC_FILES}
1732 if(ENABLE_APPLICATION_BUNDLE)
1734 # Add -Wl,-single_module to the LDFLAGS used with shared
1735 # libraries, to fix some error that show up in some cases;
1736 # some Apple documentation recommends it for most shared
1739 set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-single_module ${CMAKE_SHARED_LINKER_FLAGS}" )
1741 # Add -Wl,-headerpad_max_install_names to the LDFLAGS, as
1742 # code-signing issues is running out of padding space.
1744 # Add -Wl,-search_paths_first to make sure that if we search
1745 # directories A and B, in that order, for a given library, a
1746 # non-shared version in directory A, rather than a shared
1747 # version in directory B, is chosen (so we can use
1748 # --with-pcap=/usr/local to force all programs to be linked
1749 # with a static version installed in /usr/local/lib rather than
1750 # the system version in /usr/lib).
1753 set(CMAKE_EXE_LINKER_FLAGS
1754 "-Wl,-headerpad_max_install_names -Wl,-search_paths_first ${CMAKE_EXE_LINKER_FLAGS}"
1757 # Add files to the app bundle
1758 # Wireshark.app/Contents
1759 file(WRITE ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo "APPLWshk\n")
1760 set(BUNDLE_CONTENTS_FILES
1761 ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo
1763 set_source_files_properties(${BUNDLE_CONTENTS_FILES} PROPERTIES
1764 MACOSX_PACKAGE_LOCATION .
1767 # Wireshark.app/Contents/Resources
1768 set(BUNDLE_RESOURCE_FILES
1769 ${CMAKE_SOURCE_DIR}/packaging/macosx/Resources/Wireshark.icns
1770 ${CMAKE_SOURCE_DIR}/packaging/macosx/Resources/Wiresharkdoc.icns
1772 set_source_files_properties(${BUNDLE_RESOURCE_FILES} PROPERTIES
1773 MACOSX_PACKAGE_LOCATION Resources
1776 # Wireshark.app/Contents/Resources/share/man/man1
1777 set(BUNDLE_RESOURCE_SHARE_MAN1_FILES ${MAN1_FILES})
1778 set_source_files_properties(${BUNDLE_RESOURCE_SHARE_MAN1_FILES} PROPERTIES
1779 MACOSX_PACKAGE_LOCATION Resources/share/man/man1
1782 # Wireshark.app/Contents/Resources/share/man/man1
1783 set(BUNDLE_RESOURCE_SHARE_MAN4_FILES ${MAN4_FILES})
1784 set_source_files_properties(${BUNDLE_RESOURCE_SHARE_MAN4_FILES} PROPERTIES
1785 MACOSX_PACKAGE_LOCATION Resources/share/man/man4
1788 # INSTALL_FILES and INSTALL_DIRS are handled by copy_data_files
1790 set(EXTRA_BUNDLE_FILES
1791 ${BUNDLE_CONTENTS_FILES}
1792 ${BUNDLE_RESOURCE_FILES}
1793 ${BUNDLE_RESOURCE_SHARE_MAN1_FILES}
1794 ${BUNDLE_RESOURCE_SHARE_MAN4_FILES}
1797 set(EXTRA_BUNDLE_FILES)
1800 if(BUILD_wireshark AND QT_FOUND)
1807 ${GTHREAD2_LIBRARIES}
1810 ${APPLE_APPLICATION_SERVICES_LIBRARY}
1811 ${APPLE_CORE_FOUNDATION_LIBRARY}
1812 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
1816 # Policy since 2.8.11
1818 cmake_policy(SET CMP0020 NEW)
1821 add_executable(wireshark WIN32 MACOSX_BUNDLE wireshark-qt.cpp ${wireshark_FILES} ${EXTRA_BUNDLE_FILES})
1822 set(PROGLIST ${PROGLIST} wireshark)
1823 set_target_properties(wireshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1824 set_target_properties(wireshark PROPERTIES FOLDER "Executables")
1825 if(ENABLE_APPLICATION_BUNDLE OR WIN32)
1826 set_target_properties(wireshark PROPERTIES OUTPUT_NAME Wireshark)
1829 if(ENABLE_APPLICATION_BUNDLE)
1830 set_target_properties(
1831 wireshark PROPERTIES
1832 MACOSX_BUNDLE_INFO_PLIST ${CMAKE_BINARY_DIR}/packaging/macosx/Info.plist
1834 # Add a wrapper script which opens the bundle. This adds
1835 # convenience but makes debugging more difficult.
1836 file(REMOVE ${CMAKE_BINARY_DIR}/run/wireshark)
1837 file(WRITE ${CMAKE_BINARY_DIR}/run/wireshark "#!/bin/sh\n")
1838 file(APPEND ${CMAKE_BINARY_DIR}/run/wireshark "open ${CMAKE_BINARY_DIR}/run/Wireshark.app --args \"\$\@\"\n")
1839 execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/wireshark)
1842 target_link_libraries(wireshark ${wireshark_LIBS})
1845 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1846 BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
1849 if(NOT ENABLE_APPLICATION_BUNDLE)
1850 # Map for endpoints dialog
1854 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1855 "${PROJECT_SOURCE_DIR}/ipmap.html"
1856 $<TARGET_FILE_DIR:wireshark>
1860 if(WIN32 AND Qt5Core_FOUND)
1861 # Use windeployqt to copy our required DLLs to the run path.
1862 # Ideally one of the modules in ${QTDIR}/lib/cmake would expose
1863 # the path to windeployqt. For that matter having a reliable
1864 # path to qmake would be *amazingly convenient*. We don't have
1865 # either of those so we try to discover the path via Qt5Core.
1866 # http://stackoverflow.com/questions/24650936/qt5-with-cmake-how-to-find-qt-translations-dir
1868 get_target_property(_qmake_location Qt5::qmake IMPORTED_LOCATION)
1869 get_filename_component(_qt_bin_path "${_qmake_location}" DIRECTORY)
1870 find_program(QT_WINDEPLOYQT_EXECUTABLE windeployqt
1871 HINTS "${_qmake_location}"
1872 DOC "Path to the windeployqt utility."
1874 if (NOT "${QT_WINDEPLOYQT_EXECUTABLE}" STREQUAL "QT_WINDEPLOYQT_EXECUTABLE-NOTFOUND")
1875 set(QT_BIN_PATH "${_qt_bin_path}" CACHE INTERNAL
1876 "Path to qmake, windeployqt, and other Qt utilities."
1878 add_custom_target(copy_qt_dlls ALL)
1879 set_target_properties(copy_qt_dlls PROPERTIES FOLDER "Copy Tasks")
1880 # Will we ever need to use --debug? Windeployqt seems to
1881 # be smart enough to copy debug DLLs when needed.
1882 add_custom_command(TARGET copy_qt_dlls
1884 COMMAND set "PATH=%PATH%;${QT_BIN_PATH}"
1885 COMMAND "${QT_WINDEPLOYQT_EXECUTABLE}"
1886 $<$<CONFIG:Debug>:--debug>
1887 $<$<NOT:$<CONFIG:Debug>>:--release>
1888 --no-compiler-runtime
1890 "$<TARGET_FILE:wireshark>"
1892 add_dependencies(copy_qt_dlls wireshark)
1894 endif(WIN32 AND Qt5Core_FOUND)
1897 # Common properties for CLI executables
1898 macro(set_extra_executable_properties _executable _folder)
1899 set_target_properties(${_executable} PROPERTIES
1900 LINK_FLAGS "${WS_LINK_FLAGS}"
1904 set(PROGLIST ${PROGLIST} ${_executable})
1906 if(ENABLE_APPLICATION_BUNDLE)
1907 set_target_properties(${_executable} PROPERTIES
1908 RUNTIME_OUTPUT_DIRECTORY run/Wireshark.app/Contents/MacOS
1910 # Add a wrapper script which runs each executable from the
1911 # correct location. This adds convenience but makes debugging
1913 file(REMOVE ${CMAKE_BINARY_DIR}/run/${_executable})
1914 file(WRITE ${CMAKE_BINARY_DIR}/run/${_executable} "#!/bin/sh\n")
1915 file(APPEND ${CMAKE_BINARY_DIR}/run/${_executable} "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/${_executable} \"\$\@\"\n")
1916 execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/${_executable})
1920 macro(set_extcap_executable_properties _executable)
1921 set_target_properties(${_executable} PROPERTIES FOLDER "Executables/Extcaps")
1923 set(PROGLIST ${PROGLIST} ${_executable})
1926 set_target_properties(${_executable} PROPERTIES
1927 LINK_FLAGS "${WS_LINK_FLAGS}"
1928 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/extcap
1929 RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/run/Debug/extcap
1930 RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/run/Release/extcap
1931 RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_BINARY_DIR}/run/MinSizeRel/extcap
1932 RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/run/RelWithDebInfo/extcap
1935 set_target_properties(${_executable} PROPERTIES
1936 LINK_FLAGS "${WS_LINK_FLAGS}"
1937 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/extcap
1939 if(ENABLE_APPLICATION_BUNDLE)
1940 set_target_properties(${_executable} PROPERTIES
1941 RUNTIME_OUTPUT_DIRECTORY run/Wireshark.app/Contents/MacOS/extcap
1943 # Add a wrapper script which runs each executable from the
1944 # correct location. This adds convenience but makes debugging
1946 file(REMOVE ${CMAKE_BINARY_DIR}/run/${_executable})
1947 file(WRITE ${CMAKE_BINARY_DIR}/run/${_executable} "#!/bin/sh\n")
1948 file(APPEND ${CMAKE_BINARY_DIR}/run/${_executable} "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/extcap/${_executable} \"\$\@\"\n")
1949 execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/${_executable})
1954 if(BUILD_wireshark_gtk AND GTK_FOUND)
1955 set(wireshark_gtk_LIBS
1962 ${GTHREAD2_LIBRARIES}
1964 ${PORTAUDIO_LIBRARIES}
1966 ${APPLE_APPLICATION_SERVICES_LIBRARY}
1967 ${APPLE_CORE_SERVICES_LIBRARY}
1968 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
1970 ${WIN_COMCTL32_LIBRARY}
1972 # wireshark and wireshark-gtk share wireshark_FILES
1974 add_executable(wireshark-gtk WIN32 ${wireshark_FILES})
1975 set(PROGLIST ${PROGLIST} wireshark-gtk)
1976 set_target_properties(wireshark-gtk PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1977 set_target_properties(wireshark-gtk PROPERTIES FOLDER "Executables")
1978 target_link_libraries(wireshark-gtk ${wireshark_gtk_LIBS})
1979 install(TARGETS wireshark-gtk RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1981 # Map for endpoints dialog
1983 TARGET wireshark-gtk
1985 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1986 "${PROJECT_SOURCE_DIR}/ipmap.html"
1987 $<TARGET_FILE_DIR:wireshark-gtk>
1991 get_target_property(_wsgtk_location wireshark-gtk LOCATION)
1992 get_filename_component(_dll_output_dir "${_wsgtk_location}" PATH)
1993 add_custom_target(copy_gtk_dlls)
1994 set_target_properties(copy_gtk_dlls PROPERTIES FOLDER "Copy Tasks")
1995 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
1996 COMMAND ${CMAKE_COMMAND} -E make_directory "${_dll_output_dir}"
2000 set(_gtk_dll_dir "${GTK2_DLL_DIR}")
2001 set(_gtk_etc_dir "${GTK2_ETC_DIR}")
2002 set(_gtk_dlls "${GTK2_DLLS}")
2003 set(_gtk_etc_dir "${GTK2_ETC_DIR}")
2005 set(_gtk_dll_dir "${GTK3_DLL_DIR}")
2006 set(_gtk_dlls "${GTK3_DLLS}")
2007 set(_gtk_etc_dir "${GTK3_ETC_DIR}")
2010 foreach(_dll ${_gtk_dlls})
2011 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2012 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2013 "${_gtk_dll_dir}/${_dll}" "${_dll_output_dir}"
2018 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2019 COMMAND ${CMAKE_COMMAND} -E make_directory "${_dll_output_dir}/etc"
2021 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2022 COMMAND ${CMAKE_COMMAND} -E copy_directory
2023 "${_gtk_etc_dir}" "${_dll_output_dir}/etc"
2026 # XXX - Omitting ${GTK2_LIB_DIR}\loaders copying from Makefile.nmake
2029 set (_engines_output_dir "${_dll_output_dir}/lib/gtk-2.0/2.10.0/engines")
2030 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2031 COMMAND ${CMAKE_COMMAND} -E make_directory "${_engines_output_dir}"
2033 foreach(_dll ${GTK2_ENGINES_DLLS})
2034 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2035 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2036 "${GTK2_ENGINES_DLL_DIR}/${_dll}" "${_engines_output_dir}"
2041 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2042 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2043 "${GTK2_THEMES_DIR}/gtkrc" "${_dll_output_dir}/etc/gtk-2.0"
2047 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2048 COMMAND ${CMAKE_COMMAND} -E copy_directory
2049 "${GTK2_LIB_DIR}" "${_dll_output_dir}/lib/gtk-2.0"
2052 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2053 COMMAND ${CMAKE_COMMAND} -E copy_directory
2054 "${CMAKE_SOURCE_DIR}/ui/win32/settings.ini" "${_dll_output_dir}/etc"
2058 add_dependencies(wireshark-gtk copy_gtk_dlls copy_cli_dlls)
2062 register_tap_files(tshark-tap-register.c
2073 ${APPLE_CORE_FOUNDATION_LIBRARY}
2074 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
2078 tshark-tap-register.c
2082 ${CMAKE_BINARY_DIR}/image/tshark.rc
2084 add_executable(tshark ${tshark_FILES})
2085 set_extra_executable_properties(tshark "Executables")
2086 target_link_libraries(tshark ${tshark_LIBS})
2087 install(TARGETS tshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2094 ${APPLE_CORE_FOUNDATION_LIBRARY}
2095 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
2101 ${CMAKE_BINARY_DIR}/image/tfshark.rc
2103 add_executable(tfshark ${tfshark_FILES})
2104 set_extra_executable_properties(tfshark "Executables")
2105 target_link_libraries(tfshark ${tfshark_LIBS})
2106 install(TARGETS tfshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2109 if(BUILD_rawshark AND PCAP_FOUND)
2113 ${APPLE_CORE_FOUNDATION_LIBRARY}
2114 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
2120 ${CMAKE_BINARY_DIR}/image/rawshark.rc
2122 add_executable(rawshark ${rawshark_FILES})
2123 set_extra_executable_properties(rawshark "Executables")
2124 target_link_libraries(rawshark ${rawshark_LIBS})
2125 install(TARGETS rawshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2136 add_executable(dftest ${dftest_FILES})
2137 set_extra_executable_properties(dftest "Tests")
2138 target_link_libraries(dftest ${dftest_LIBS})
2139 install(TARGETS dftest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2158 add_executable(randpkt ${randpkt_FILES})
2159 set_extra_executable_properties(randpkt "Executables")
2160 target_link_libraries(randpkt ${randpkt_LIBS})
2161 install(TARGETS randpkt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2170 set(text2pcap_CLEAN_FILES
2175 ${text2pcap_CLEAN_FILES}
2176 ${CMAKE_BINARY_DIR}/image/text2pcap.rc
2178 add_lex_files(text2pcap_FILES
2181 add_executable(text2pcap ${text2pcap_FILES})
2182 set_extra_executable_properties(text2pcap "Executables")
2183 target_link_libraries(text2pcap ${text2pcap_LIBS})
2184 install(TARGETS text2pcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2195 ${CMAKE_BINARY_DIR}/image/mergecap.rc
2197 add_executable(mergecap ${mergecap_FILES})
2198 set_extra_executable_properties(mergecap "Executables")
2199 target_link_libraries(mergecap ${mergecap_LIBS})
2200 install(TARGETS mergecap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2203 if(BUILD_reordercap)
2209 set(reordercap_FILES
2211 ${CMAKE_BINARY_DIR}/image/reordercap.rc
2213 add_executable(reordercap ${reordercap_FILES})
2214 set_extra_executable_properties(reordercap "Executables")
2215 target_link_libraries(reordercap ${reordercap_LIBS})
2216 install(TARGETS reordercap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2229 ${CMAKE_BINARY_DIR}/image/capinfos.rc
2231 add_executable(capinfos ${capinfos_FILES})
2232 set_extra_executable_properties(capinfos "Executables")
2233 target_link_libraries(capinfos ${capinfos_LIBS})
2234 install(TARGETS capinfos RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2246 ${CMAKE_BINARY_DIR}/image/captype.rc
2248 add_executable(captype ${captype_FILES})
2249 set_extra_executable_properties(captype "Executables")
2250 target_link_libraries(captype ${captype_LIBS})
2251 install(TARGETS captype RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2262 ${CMAKE_BINARY_DIR}/image/editcap.rc
2264 add_executable(editcap ${editcap_FILES})
2265 set_extra_executable_properties(editcap "Executables")
2266 target_link_libraries(editcap ${editcap_LIBS})
2267 install(TARGETS editcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2270 if(BUILD_dumpcap AND PCAP_FOUND)
2279 ${GTHREAD2_LIBRARIES}
2281 ${APPLE_CORE_FOUNDATION_LIBRARY}
2282 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
2287 capture_stop_conditions.c
2293 ${CMAKE_BINARY_DIR}/image/dumpcap.rc
2295 add_executable(dumpcap ${dumpcap_FILES})
2296 set_extra_executable_properties(dumpcap "Executables")
2297 target_link_libraries(dumpcap ${dumpcap_LIBS})
2298 install(TARGETS dumpcap
2299 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
2300 PERMISSIONS ${DUMPCAP_SETUID}
2301 OWNER_READ OWNER_WRITE OWNER_EXECUTE
2302 GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
2304 if(DUMPCAP_INSTALL_OPTION STREQUAL "capabilities")
2305 install( CODE "execute_process(
2307 ${SETCAP_EXECUTABLE}
2308 cap_net_raw,cap_net_admin+ep
2309 ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/dumpcap${CMAKE_EXECUTABLE_SUFFIX}
2313 if( _SETCAP_RESULT )
2314 message( WARNING \"setcap failed (${_SETCAP_RESULT}).\")
2321 find_package( MSVC_REDIST )
2323 # Must come after executable targets are defined.
2324 find_package( NSIS )
2326 if (NOT "${MAKENSIS_EXECUTABLE}" STREQUAL "MAKENSIS_EXECUTABLE-NOTFOUND")
2327 add_subdirectory( packaging/nsis EXCLUDE_FROM_ALL )
2328 ADD_NSIS_UNINSTALLER_TARGET()
2329 ADD_NSIS_PACKAGE_TARGET()
2332 find_package( PortableApps )
2334 NOT "${PORTABLEAPPS_LAUNCHER_GENERATOR_EXECUTABLE}" STREQUAL "PORTABLEAPPS_LAUNCHER_GENERATOR_EXECUTABLE-NOTFOUND"
2336 NOT "${PORTABLEAPPS_INSTALLER_EXECUTABLE}" STREQUAL "PORTABLEAPPS_INSTALLER_EXECUTABLE-NOTFOUND"
2338 add_subdirectory( packaging/portableapps EXCLUDE_FROM_ALL )
2339 ADD_PORTABLEAPPS_PACKAGE_TARGET()
2343 if(BUILD_androiddump)
2344 if(EXTCAP_ANDROIDDUMP_LIBPCAP)
2346 set(androiddump_LIBS
2351 message(FATAL_ERROR "You try to build androiddump with libpcap but do not have it")
2354 set(androiddump_LIBS
2360 set(androiddump_FILES
2361 extcap/androiddump.c
2364 add_executable(androiddump WIN32 ${androiddump_FILES})
2365 # XXX Shouldn't we add wsutil to androiddump_LIBS instead?
2366 set_extcap_executable_properties(androiddump)
2367 target_link_libraries(androiddump ${androiddump_LIBS})
2368 install(TARGETS androiddump RUNTIME DESTINATION ${EXTCAP_DIR})
2371 if(BUILD_sshdump AND LIBSSH_FOUND)
2378 set(sshdump_LIBS wsutil ${sshdump_LIBS})
2384 add_executable(sshdump WIN32 ${sshdump_FILES})
2385 set_extcap_executable_properties(sshdump)
2386 target_link_libraries(sshdump ${sshdump_LIBS})
2387 target_include_directories(sshdump PUBLIC ${LIBSSH_INCLUDE_DIR})
2388 install(TARGETS sshdump RUNTIME DESTINATION ${EXTCAP_DIR})
2389 elseif (BUILD_sshdump)
2390 #message( WARNING "Cannot find libssh, cannot build sshdump" )
2393 if(BUILD_randpktdump)
2394 set(randpktdump_LIBS
2399 set(randpktdump_FILES
2400 extcap/randpktdump.c
2404 add_executable(randpktdump WIN32 ${randpktdump_FILES})
2405 # XXX Shouldn't we add wsutil to randpktdump_LIBS instead?
2406 set_extcap_executable_properties(randpktdump)
2407 target_link_libraries(randpktdump ${randpktdump_LIBS})
2408 install(TARGETS randpktdump RUNTIME DESTINATION ${EXTCAP_DIR})
2412 OUTPUT ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2413 COMMAND ${PERL_EXECUTABLE}
2414 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
2415 ${CMAKE_SOURCE_DIR}/doc/make-authors-short.pl
2416 < ${CMAKE_SOURCE_DIR}/AUTHORS
2417 > ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2419 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
2420 ${CMAKE_SOURCE_DIR}/doc/make-authors-short.pl
2421 ${CMAKE_SOURCE_DIR}/AUTHORS
2425 OUTPUT ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2426 COMMAND ${PERL_EXECUTABLE}
2427 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
2428 ${CMAKE_SOURCE_DIR}/doc/make-authors-format.pl
2429 < ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2430 > ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2432 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
2433 ${CMAKE_SOURCE_DIR}/doc/make-authors-format.pl
2434 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2438 FILE(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template WPT_WIN_PATH)
2439 FILE(TO_NATIVE_PATH ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT ASF_WIN_PATH)
2440 FILE(TO_NATIVE_PATH ${CMAKE_BINARY_DIR}/wireshark.pod WP_WIN_PATH)
2442 OUTPUT ${CMAKE_BINARY_DIR}/wireshark.pod
2443 COMMAND copy /B ${WPT_WIN_PATH} + ${ASF_WIN_PATH} ${WP_WIN_PATH}
2445 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
2446 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2451 OUTPUT ${CMAKE_BINARY_DIR}/wireshark.pod
2453 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
2454 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2455 > ${CMAKE_BINARY_DIR}/wireshark.pod
2457 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
2458 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2462 if(ENABLE_APPLICATION_BUNDLE)
2463 add_custom_target(app_bundle)
2464 set_target_properties(app_bundle PROPERTIES FOLDER "Copy Tasks")
2465 add_custom_command(TARGET app_bundle
2467 COMMAND "${CMAKE_SOURCE_DIR}/packaging/macosx/osx-app.sh"
2468 WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/run"
2470 add_dependencies(app_bundle ${PROGLIST})
2472 add_custom_target(dmg_package_prep DEPENDS app_bundle)
2475 OUTPUT ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo
2476 COMMAND ${CMAKE_COMMAND} -E echo APPLWshk > ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo
2479 ADD_CUSTOM_TARGET( dmg_package
2480 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2481 "${PROJECT_SOURCE_DIR}/ipmap.html"
2482 $<TARGET_FILE_DIR:wireshark>
2483 COMMAND ${CMAKE_COMMAND} -E copy_directory
2484 ${CMAKE_SOURCE_DIR}/packaging/macosx/ChmodBPF
2485 ${CMAKE_BINARY_DIR}/run/ChmodBPF
2486 COMMAND ${CMAKE_COMMAND} -E copy_directory
2487 ${CMAKE_SOURCE_DIR}/packaging/macosx/Resources
2488 ${CMAKE_BINARY_DIR}/run/Resources
2489 COMMAND ${CMAKE_COMMAND} -E copy_directory
2490 ${CMAKE_SOURCE_DIR}/packaging/macosx/Scripts
2491 ${CMAKE_BINARY_DIR}/run/Scripts
2492 COMMAND ${CMAKE_COMMAND} -E copy_directory
2493 ${CMAKE_SOURCE_DIR}/packaging/macosx/utility-launcher
2494 ${CMAKE_BINARY_DIR}/run/utility-launcher
2495 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2496 ${CMAKE_SOURCE_DIR}/COPYING
2497 ${CMAKE_BINARY_DIR}/run/COPYING.txt
2498 COMMAND ${CMAKE_COMMAND} -E copy_directory
2499 ${CMAKE_SOURCE_DIR}/packaging/macosx/Wireshark_package.pmdoc
2500 ${CMAKE_BINARY_DIR}/run/Wireshark_package.pmdoc
2501 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2502 ${CMAKE_BINARY_DIR}/packaging/macosx/Wireshark_package.pmdoc/index.xml
2503 ${CMAKE_BINARY_DIR}/run/Wireshark_package.pmdoc/index.xml
2504 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2505 ${CMAKE_SOURCE_DIR}/packaging/macosx/dmg_background.png
2506 ${CMAKE_BINARY_DIR}/run/dmg_background.png
2507 COMMAND bash -x ${CMAKE_BINARY_DIR}/packaging/macosx/osx-dmg.sh
2508 --source-directory ${CMAKE_SOURCE_DIR}/packaging/macosx
2509 # Unlike nsis_package_prep + nsis_package, we can add a direct
2511 DEPENDS dmg_package_prep
2512 # We create Wireshark.app in "run". Do our work there.
2513 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/run
2518 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/androiddump 1 )
2519 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/capinfos 1 )
2520 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/captype 1 )
2521 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dftest 1 )
2522 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dumpcap 1 )
2523 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/editcap 1 )
2524 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/extcap 4 )
2525 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/asn2deb 1 )
2526 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2deb 1 )
2527 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2wrs 1 )
2528 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/mergecap 1 )
2529 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/randpkt 1 )
2530 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/randpktdump 1 )
2531 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/rawshark 1 )
2532 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/reordercap 1 )
2533 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/sshdump 1 )
2534 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/text2pcap 1 )
2535 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/tshark 1 )
2536 pod2manhtml( ${CMAKE_BINARY_DIR}/wireshark 1 )
2537 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/wireshark-filter 4 )
2542 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2561 wireshark-filter.html
2563 set_target_properties(html_docs PROPERTIES FOLDER "Docs")
2571 ${randpktdump_FILES}
2572 ${text2pcap_CLEAN_FILES}
2578 ${androiddump_FILES}
2582 if (WERROR_COMMON_FLAGS)
2583 set_source_files_properties(
2586 COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
2594 ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
2601 ${CMAKE_INSTALL_MANDIR}/man1
2608 ${CMAKE_INSTALL_MANDIR}/man4
2613 "${CMAKE_BINARY_DIR}/wireshark.pc"
2615 ${CMAKE_INSTALL_LIBDIR}/pkgconfig
2621 DIRECTORY_PERMISSIONS
2622 OWNER_EXECUTE OWNER_WRITE OWNER_READ
2623 GROUP_EXECUTE GROUP_READ
2624 WORLD_EXECUTE WORLD_READ
2626 ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
2627 PATTERN ".git" EXCLUDE
2628 PATTERN ".svn" EXCLUDE
2629 PATTERN "Makefile.*" EXCLUDE
2630 PATTERN "faq.py" EXCLUDE
2633 include( UseCheckAPI )
2639 set(CMAKE_INSTALL_MODULES_DIR ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME})
2640 configure_file("${CMAKE_MODULE_PATH}/WiresharkConfig.cmake.in" "${CMAKE_BINARY_DIR}/WiresharkConfig.cmake" @ONLY)
2641 configure_file("${CMAKE_MODULE_PATH}/WiresharkConfigVersion.cmake.in" "${CMAKE_BINARY_DIR}/WiresharkConfigVersion.cmake" @ONLY)
2644 ${CMAKE_MODULE_PATH}/FindGLIB2.cmake
2645 ${CMAKE_MODULE_PATH}/FindWireshark.cmake
2646 ${CMAKE_MODULE_PATH}/FindWSWinLibs.cmake
2647 ${CMAKE_MODULE_PATH}/UseAsn2Wrs.cmake
2648 ${CMAKE_MODULE_PATH}/LocatePythonModule.cmake
2649 ${CMAKE_MODULE_PATH}/UseMakeDissectorReg.cmake
2650 ${CMAKE_BINARY_DIR}/WiresharkConfig.cmake
2651 ${CMAKE_BINARY_DIR}/WiresharkConfigVersion.cmake
2653 ${CMAKE_INSTALL_MODULES_DIR}
2657 message(STATUS "Docdir install: ${DOC_DIR}")
2660 ${CMAKE_BINARY_DIR}/docbook/
2661 DIRECTORY_PERMISSIONS
2662 OWNER_EXECUTE OWNER_WRITE OWNER_READ
2663 GROUP_EXECUTE GROUP_READ
2664 WORLD_EXECUTE WORLD_READ
2672 # Test suite wrapper
2673 if(ENABLE_APPLICATION_BUNDLE)
2674 set(TEST_SH_BIN_DIR ${CMAKE_BINARY_DIR}/run)
2676 set(TEST_SH_BIN_DIR $<TARGET_FILE_DIR:epan>)
2679 add_custom_target(test-sh
2680 COMMAND ${CMAKE_COMMAND}
2681 -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
2682 -DTEST_SH_BIN_DIR=${TEST_SH_BIN_DIR}
2683 -DTEST_SH_SRC_DIR=${CMAKE_SOURCE_DIR}/test
2684 -P ${CMAKE_SOURCE_DIR}/cmake/modules/GenerateTestSh.cmake
2685 DEPENDS ${CMAKE_SOURCE_DIR}/cmake/modules/GenerateTestSh.cmake
2687 set_target_properties(test-sh PROPERTIES FOLDER "Tests")
2689 add_custom_target(test-programs
2696 COMMENT "Building unit test programs and wrapper"
2698 set_target_properties(test-programs PROPERTIES FOLDER "Tests")
2701 file (TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/tools/Get-HardenFlags.ps1 _win_harden_flags)
2702 add_custom_target(hardening-check
2703 COMMAND ${POWERSHELL_COMMAND} "${_win_harden_flags}" "${_dll_output_dir_win}"
2705 COMMENT "Checking binaries for security features"
2707 set_target_properties(hardening-check PROPERTIES FOLDER "Tests")
2709 find_program(HARDENING_CHECK_EXECUTABLE hardening-check
2710 DOC "Path to the hardening-check utility."
2712 if (NOT "${HARDENING_CHECK_EXECUTABLE}" STREQUAL "HARDENING_CHECK_EXECUTABLE-NOTFOUND")
2713 foreach(_prog ${PROGLIST})
2714 get_target_property(_prog_dir ${_prog} RUNTIME_OUTPUT_DIRECTORY)
2715 if ("${_prog_dir}" STREQUAL "_prog_dir-NOTFOUND")
2716 set(_prog_dir "${CMAKE_BINARY_DIR}/run")
2718 set(_prog_paths ${_prog_paths} "${_prog_dir}/${_prog}")
2720 add_custom_target(hardening-check
2721 COMMAND ${HARDENING_CHECK_EXECUTABLE} ${_prog_paths}
2723 COMMENT "Checking binaries for security features"
2729 # Editor modelines - http://www.wireshark.org/tools/modelines.html
2734 # indent-tabs-mode: t
2737 # vi: set shiftwidth=8 tabstop=8 noexpandtab:
2738 # :indentSize=8:tabSize=8:noTabs=false: