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
214 include( CMakeOptions.txt )
215 if( DUMPCAP_INSTALL_OPTION STREQUAL "suid" )
216 set( DUMPCAP_SETUID "SETUID" )
218 set( DUMPCAP_SETUID )
220 if( NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND
221 DUMPCAP_INSTALL_OPTION STREQUAL "capabilities" )
222 message( WARNING "Capabilities are only supported on Linux" )
223 set( DUMPCAP_INSTALL_OPTION )
226 # Always enable position-independent code when compiling, even for
227 # executables, so you can build position-independent executables.
228 # -pie is added below for non-MSVC.
229 # Needed when either:
230 # - Qt5_POSITION_INDEPENDENT_CODE is set and CMake < 2.8.11
231 # - PIE is wanted (-pie) and you want to add -fPIC/-fPIE automatically.
232 # This option only has an effect on CMake >= 2.8.9
233 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
235 if( CMAKE_C_COMPILER_ID MATCHES "MSVC")
237 set(MSC_VER_REQUIRED 1600)
239 set(MSC_VER_REQUIRED 1700)
241 set(MSC_VER_REQUIRED 1800)
243 set(MSC_VER_REQUIRED 1900)
245 message(FATAL_ERROR "You are using an unsupported version of MSVC")
249 /DWIN32_LEAN_AND_MEAN
250 "/DMSC_VER_REQUIRED=${MSC_VER_REQUIRED}"
251 /D_CRT_SECURE_NO_DEPRECATE
252 /D_CRT_NONSTDC_NO_DEPRECATE
253 # NOMINMAX keeps windows.h from defining "min" and "max" via windef.h.
254 # This avoids conflicts with the C++ standard library.
256 # -DPSAPI_VERSION=1 Programs that must run on earlier versions of Windows as well as Windows 7 and later
257 # versions should always call this function as GetProcessMemoryInfo. To ensure correct
258 # resolution of symbols, add Psapi.lib to the TARGETLIBS macro and compile the program
259 # with -DPSAPI_VERSION=1.To use run-time dynamic linking, load Psapi.dll.
260 # http://msdn.microsoft.com/en-us/library/windows/desktop/ms683219(v=vs.85).aspx
261 # -DBUILD_WINDOWS Starting from VS2013, GetVersionEx is deprecated and we are recommended to use
262 # VerifyVersionInfo instead
263 # http://msdn.microsoft.com/en-us/library/windows/desktop/ms724429(v=vs.85).aspx
264 # http://msdn.microsoft.com/en-us/library/windows/desktop/ms725491(v=vs.85).aspx
265 # To continue to use GetVersionEx, we can define BUILD_WINDOWS
266 # -D_ALLOW_KEYWORD_MACROS For VS2012 onwards the, C++ STL does not permit macro redefinitions of keywords
267 # (see http://msdn.microsoft.com/en-us/library/bb531344(v=vs.110).aspx)
268 # This definition prevents the complaint about the redefinition of inline by WinPCap
269 # in pcap-stdinc.h when compiling C++ files, e.g. the Qt UI
272 /D_ALLOW_KEYWORD_MACROS
275 if(NOT "${WIRESHARK_TARGET_PLATFORM}" STREQUAL "win64")
276 add_definitions("/D_BIND_TO_CURRENT_CRT_VERSION=1")
279 # FIXME: WINPCAP_VERSION cannot be determined from source or executable.
280 set(WINPCAP_VERSION "4_1_3")
281 add_definitions("/DWINPCAP_VERSION=${WINPCAP_VERSION}")
288 # /Zo Enhanced debugging of optimised code for VS2013 Update 3 and beyond,
289 # Assume all VS2013 builds are at least Update 3.
290 # See http://msdn.microsoft.com/en-us/library/dn785163.aspx
291 set(LOCAL_CFLAGS ${LOCAL_CFLAGS} "/Zo")
293 # /Zo Enhanced debugging of optimised code
294 # VS2015(MSVC14): On by default when /Zi or /Z7 used.
295 set(LOCAL_CFLAGS ${LOCAL_CFLAGS} "/Zo")
298 if(ENABLE_CODE_ANALYSIS)
299 set(LOCAL_CFLAGS ${LOCAL_CFLAGS} "/analyze:WX-")
302 # Additional compiler warnings to be treated as "Level 3"
303 # when compiling Wireshark sources. (Selected from "level 4" warnings).
304 ## 4295: array is too small to include a terminating null character
305 ## 4189: local variable is initialized but not referenced
306 set(WARNINGS_CFLAGS "/w34295 /w34189")
308 set(WIRESHARK_COMMON_FLAGS
313 # Set in Makefile.nmake
314 set(WS_LINK_FLAGS "/LARGEADDRESSAWARE /MANIFEST:NO /INCREMENTAL:NO /RELEASE")
317 if(CMAKE_OSX_DEPLOYMENT_TARGET)
319 if(${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.0")
320 message(FATAL_ERROR "We don't support building for OS X 10.0")
321 elseif(${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.1")
322 message(FATAL_ERROR "We don't support building for OS X 10.1")
323 elseif(${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.2")
324 message(FATAL_ERROR "We don't support building for OS X 10.2")
325 elseif(${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.4" OR ${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.5")
327 # Only 32-bit builds are supported. 10.5
328 # (and 10.4?) had a bug that causes some BPF
329 # functions not to work with 64-bit userland
330 # code, so capturing won't work.
332 set(CMAKE_C_FLAGS "-m32 ${CMAKE_C_FLAGS}")
333 set(CMAKE_CXX_FLAGS "-m32 ${CMAKE_CXX_FLAGS}")
334 set(WS_LINK_FLAGS "-m32 ${WS_LINK_FLAGS}")
336 message(STATUS "Building for OS X ${CMAKE_OSX_DEPLOYMENT_TARGET}")
338 message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET only applies when building for OS X")
342 set(WIRESHARK_COMMON_FLAGS
343 # The following are for C and C++
344 # -O<X> and -g get set by the CMAKE_BUILD_TYPE
360 -Wno-overlength-strings
363 -Wunused-const-variable
366 set(WIRESHARK_C_ONLY_FLAGS
367 # The following are C only, not C++
369 -Wdeclaration-after-statement
372 -Wold-style-definition
376 # The Qt headers generate a ton of shortening errors on 64-bit systems
377 # so only enable this for C for now.
381 set(WIRESHARK_CXX_ONLY_FLAGS
384 set(WIRESHARK_EXTRA_COMPILER_COMMON_FLAGS
385 # The following are for C and C++
388 # As we use variadic macros, we don't want warnings
389 # about them, even with -Wpedantic.
393 # Various code blocks this one.
396 -fstrict-overflow -Wstrict-overflow=4
398 # Due to various places where APIs we don't control
399 # require us to cast away constness, we can probably
400 # never enable this one with -Werror.
404 # Some generated ASN.1 dissectors block this one;
405 # multiple function declarations for the same
406 # function are being generated.
410 # Some loops are safe, but it's hard to convince the
413 -Wunsafe-loop-optimizations
415 # All the registration functions block these for now.
418 -Wmissing-declarations
420 # A bunch of "that might not work on SPARC" code blocks
425 # Works only with Clang
429 # Works only with Clang but generates a lot of warnings
430 # (about glib library not using Doxygen)
434 # No longer supported by El Capitan clang on C++
436 -fno-delete-null-pointer-checks
439 set(WIRESHARK_EXTRA_COMPILER_C_ONLY_FLAGS
440 # The following are C only, not C++
442 # Due to various places where APIs we don't control
443 # require us to cast away constness, we can probably
444 # never enable this one with -Werror.
449 set(WIRESHARK_EXTRA_COMPILER_CXX_ONLY_FLAGS
452 if(CMAKE_C_COMPILER_ID MATCHES "Clang")
453 set(WIRESHARK_COMMON_FLAGS ${WIRESHARK_COMMON_FLAGS}
454 # avoid "argument unused during compilation" warnings
455 # (for example, when getting the -gsplit-dwarf option or
456 # when combining -fwrapv with -fno-strict-overflow)
460 set(WIRESHARK_CXX_ONLY_FLAGS ${WIRESHARK_CXX_ONLY_FLAGS}
463 set(WIRESHARK_COMMON_FLAGS ${WIRESHARK_COMMON_FLAGS}
464 -fexcess-precision=fast
467 set(WIRESHARK_C_ONLY_FLAGS ${WIRESHARK_C_ONLY_FLAGS}
471 set(WIRESHARK_ASAN_FLAGS
472 # With Clang >= 3.5 Leak detection is enable by default
473 # and no yet all leak is fixed...
474 # use ASAN_OPTIONS=detect_leaks=0 to disable detect_leaks
476 -fsanitize=undefined # compile and runtime checks
477 # -fsanitize=float-divide-by-zero
478 # -fsanitize=float-cast-overflow
479 # -fno-sanitize-recover # Abort during runtime
483 set(WIRESHARK_COMMON_FLAGS ${WIRESHARK_COMMON_FLAGS} ${WIRESHARK_ASAN_FLAGS})
486 if(ENABLE_EXTRA_COMPILER_WARNINGS) # This overrides -Werror
487 set(WIRESHARK_COMMON_FLAGS ${WIRESHARK_COMMON_FLAGS} ${WIRESHARK_EXTRA_COMPILER_COMMON_FLAGS})
488 set(WIRESHARK_C_ONLY_FLAGS ${WIRESHARK_C_ONLY_FLAGS} ${WIRESHARK_EXTRA_COMPILER_C_ONLY_FLAGS})
489 set(WIRESHARK_CXX_ONLY_FLAGS ${WIRESHARK_CXX_ONLY_FLAGS} ${WIRESHARK_EXTRA_COMPILER_CXX_ONLY_FLAGS})
493 -DG_DISABLE_DEPRECATED
494 -DG_DISABLE_SINGLE_INCLUDES
498 set( C_FLAG_TESTS ${WIRESHARK_COMMON_FLAGS} ${WIRESHARK_C_ONLY_FLAGS} )
499 set( CXX_FLAG_TESTS ${WIRESHARK_COMMON_FLAGS} ${WIRESHARK_CXX_ONLY_FLAGS} )
501 # Counterhack to work around some cache magic in CHECK_C_SOURCE_COMPILES
502 include(CheckCCompilerFlag)
503 include(CheckCXXCompilerFlag)
506 set(BUILD_SHARED_LIBS 0)
507 set(LINK_MODE_LIB STATIC)
508 set(LINK_MODE_MODULE STATIC)
510 set(BUILD_SHARED_LIBS 1)
511 set(LINK_MODE_LIB SHARED)
512 set(LINK_MODE_MODULE MODULE)
515 # Sigh: Have to use THIS_FLAG instead of ${F} for some reason
516 foreach(THIS_FLAG ${C_FLAG_TESTS})
517 string( REGEX REPLACE "[^a-zA-Z0-9_]+" "_" F ${THIS_FLAG} )
518 set(${F} ${THIS_FLAG})
520 message(STATUS "Checking for c-compiler flag: ${THIS_FLAG}")
521 check_c_compiler_flag("${ADDED_CMAKE_C_FLAGS} ${${F}}" ${V})
523 set(ADDED_CMAKE_C_FLAGS "${ADDED_CMAKE_C_FLAGS} ${${F}}")
526 set(CMAKE_C_FLAGS "${ADDED_CMAKE_C_FLAGS} ${CMAKE_C_FLAGS}")
528 foreach(THIS_FLAG ${CXX_FLAG_TESTS})
529 string( REGEX REPLACE "[^a-zA-Z0-9_]+" "_" F ${THIS_FLAG} )
530 set(${F} ${THIS_FLAG})
531 set(V CXX_${F}_VALID)
532 message(STATUS "Checking for c++-compiler flag: ${THIS_FLAG}")
533 check_cxx_compiler_flag("${ADDED_CMAKE_CXX_FLAGS} ${${F}}" ${V})
535 set(ADDED_CMAKE_CXX_FLAGS "${ADDED_CMAKE_CXX_FLAGS} ${${F}}")
538 set(CMAKE_CXX_FLAGS "${ADDED_CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
540 if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_COMPILER_WARNINGS)
541 if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
542 set(WERROR_COMMON_FLAGS "/WX")
543 set(NO_ERROR_DEPRECATED_DECLARATIONS_COMPILE_FLAGS)
545 check_c_compiler_flag(-Werror WERROR)
547 set(WERROR_COMMON_FLAGS "-Werror")
548 set(NO_ERROR_DEPRECATED_DECLARATIONS_COMPILE_FLAGS "-Wno-error=deprecated-declarations")
552 set(WERROR_COMMON_FLAGS FALSE)
556 # Try to have the compiler default to hiding symbols, so that only
557 # symbols explicitly exported with WS_DLL_PUBLIC will be visible
558 # outside (shared) libraries; that way, more UN*X builds will catch
559 # failures to export symbols, rather than having that fail only on
562 # We don't need that with MSVC, as that's the default.
564 if( NOT CMAKE_C_COMPILER_ID MATCHES "MSVC")
566 # Try the GCC-and-compatible -fvisibility-hidden first.
568 check_c_compiler_flag(-fvisibility=hidden FVHIDDEN)
570 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
573 # OK, try the Sun^WOracle C -xldscope=hidden
575 check_c_compiler_flag(-xldscope=hidden XLDSCOPEHIDDEN)
577 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -xldscope=hidden")
581 # If there is anything else, we might want to
582 # make a list of options to try, and try them
585 message(WARNING "Hiding shared library symbols is not supported by the compiler."
586 " All shared library symbols will be exported.")
591 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
592 set (C_UNUSED "__attribute__((unused))" )
597 set(WIRESHARK_LD_FLAGS
603 # CMAKE_POSITION_INDEPENDENT_CODE is only supported starting with CMake
604 # 2.8.9. Do not add -pie automatically for older versions.
606 # XXX - are there other compilers that don't support -pie? It's
607 # not as if the only platforms we support are Windows and Linux....
609 if(NOT CMAKE_VERSION VERSION_LESS "2.8.9")
610 set(WIRESHARK_LD_FLAGS ${WIRESHARK_LD_FLAGS}
615 include(CheckCLinkerFlag)
617 # Sigh: Have to use THIS_FLAG instead of ${F} for some reason
618 foreach(THIS_FLAG ${WIRESHARK_LD_FLAGS})
619 set(F WS_LD_FLAG_${_C})
620 set(${F} ${THIS_FLAG})
621 set(V WS_LD_FLAG_VALID${_C})
622 check_c_linker_flag(${${F}} ${V})
624 set(WS_LINK_FLAGS "${WS_LINK_FLAGS} ${${F}}")
626 math(EXPR _C "${_C} + 1")
629 if(APPLE AND EXISTS /usr/local/opt/gettext)
630 # GLib on OS X requires libintl. Homebrew installs gettext (and
631 # libintl) in /usr/local/opt/gettext
632 include_directories(/usr/local/opt/gettext/include)
633 link_directories(/usr/local/opt/gettext/lib)
636 # The packagelist is doing some magic: If we add XXX to the packagelist, we
637 # - may optionally set XXX_OPTIONS to pass to the find_package command
638 # - will call FindXXX.cmake
639 # - return found libraries in XXX_LIBRARIES
640 # - return found include in XXX_INCLUDE_DIRS
643 #The minimum package list
644 set(PACKAGELIST Gettext M Git GLIB2 GMODULE2 GTHREAD2 LEX YACC Perl SED SH PythonInterp)
645 set(LEX_REQUIRED TRUE)
646 set(GLIB2_REQUIRED TRUE)
647 set(GLIB2_FIND_REQUIRED TRUE)
648 set(GLIB2_MIN_VERSION 2.14.0)
649 set(GTHREAD2_REQUIRED TRUE)
650 set(PythonInterp_FIND_VERSION 2)
651 set(Python_ADDITIONAL_VERSIONS 3)
652 set(YACC_REQUIRED TRUE)
658 set(PACKAGELIST ${PACKAGELIST} HtmlViewer)
660 set(PACKAGELIST ${PACKAGELIST} LIBSSH)
661 set(LIBSSH_OPTIONS "0.6")
664 set(PACKAGELIST ${PACKAGELIST} PCAP)
668 set(PACKAGELIST ${PACKAGELIST} AIRPCAP)
672 if(BUILD_wireshark_gtk)
674 set(PACKAGELIST ${PACKAGELIST} GTK3)
676 set(PACKAGELIST ${PACKAGELIST} GTK2)
677 set(GTK2_OPTIONS COMPONENTS gtk)
678 set(GTK2_FIND_VERSION 2.12)
679 set(GTK2_DEBUG false)
686 # Untested, may not work if CMAKE_PREFIX_PATH gets overwritten
687 # somewhere. The if WIN32 in this place is annoying as well.
689 set( QT5_BASE_PATH "$ENV{QT5_BASE_DIR}" )
690 set( CMAKE_PREFIX_PATH "${QT5_BASE_PATH}" )
692 set(PACKAGELIST ${PACKAGELIST}
701 set(PACKAGELIST ${PACKAGELIST} Qt5MacExtras)
704 set(PACKAGELIST ${PACKAGELIST} Qt5WinExtras)
708 set(PACKAGELIST ${PACKAGELIST} Qt4)
709 set(Qt4_OPTIONS 4.7.1 REQUIRED QtCore QtGui)
716 set(PACKAGELIST ${PACKAGELIST} SMI)
721 set(PACKAGELIST ${PACKAGELIST} GCRYPT)
722 # Minimum version needed.
723 set(GCRYPT_OPTIONS "1.4.2")
726 # GNU SSL/TLS support
728 set(PACKAGELIST ${PACKAGELIST} GNUTLS)
729 # Minimum version needed.
730 set(GNUTLS_OPTIONS "2.12.0")
735 set(PACKAGELIST ${PACKAGELIST} KERBEROS)
738 # Portable audio (GTK+ only)
739 if(ENABLE_PORTAUDIO AND BUILD_wireshark_gtk)
740 set(PACKAGELIST ${PACKAGELIST} PORTAUDIO)
744 # Prefer c-ares over adns
745 if(ENABLE_CARES) # C Asynchronouse resolver
746 set(PACKAGELIST ${PACKAGELIST} CARES)
747 elseif(ENABLE_ADNS) # Gnu asynchronous DNS
748 set(PACKAGELIST ${PACKAGELIST} ADNS)
754 # On Windows we build our own version of zlib, so add the paths
755 set(ZLIB_SRC_DIR "${_PROJECT_LIB_DIR}/zlib-1.2.8-ws")
756 set(SKIP_INSTALL_ALL True) # We copy the DLL ourselves.
757 add_subdirectory("${ZLIB_SRC_DIR}" "${CMAKE_BINARY_DIR}/zlib")
758 unset(SKIP_INSTALL_ALL)
759 set(ZLIB_INCLUDE_DIR "${ZLIB_SRC_DIR}" "${CMAKE_BINARY_DIR}/zlib")
760 set(ZLIB_LIBRARY zlib)
761 set(ZLIB_DLL "zlib1.dll")
762 set_target_properties(zlib PROPERTIES FOLDER "Libs/zlib")
763 # Annoyingly zlib also builds some other stuff we aren't interested in
764 set_target_properties(zlibstatic PROPERTIES FOLDER "Libs/zlib")
766 set(PACKAGELIST ${PACKAGELIST} ZLIB)
769 # Embedded Lua interpreter
771 set(PACKAGELIST ${PACKAGELIST} LUA)
774 # GeoIP address resolving
776 set(PACKAGELIST ${PACKAGELIST} GEOIP)
780 set(PACKAGELIST ${PACKAGELIST} NL)
784 set(PACKAGELIST ${PACKAGELIST} SBC)
789 set(PACKAGELIST ${PACKAGELIST} CAP SETCAP)
792 # Windows version updates
793 if(ENABLE_WINSPARKLE)
794 set(PACKAGELIST ${PACKAGELIST} WINSPARKLE)
797 set(PACKAGELIST ${PACKAGELIST} YAPP)
799 set(PACKAGELIST ${PACKAGELIST} POD)
801 if(ENABLE_HTML_GUIDES)
802 set(PACKAGELIST ${PACKAGELIST} DOXYGEN)
807 # Sort the package list
808 list(SORT PACKAGELIST)
809 message(STATUS "Packagelist: ${PACKAGELIST}")
810 # Let's loop the package list
811 foreach(PACKAGE ${PACKAGELIST})
812 if(${PACKAGE} STREQUAL "Qt4")
813 set(PACKAGE_VAR "QT")
814 elseif(${PACKAGE} STREQUAL "PythonInterp")
815 set(PACKAGE_VAR "PYTHONINTERP")
816 elseif(${PACKAGE} STREQUAL "Gettext")
817 set(PACKAGE_VAR "GETTEXT")
818 elseif(${PACKAGE} STREQUAL "HtmlViewer")
819 set(PACKAGE_VAR "HTML_VIEWER")
820 elseif(${PACKAGE} STREQUAL "Perl")
821 set(PACKAGE_VAR "PERL")
823 set(PACKAGE_VAR ${PACKAGE})
825 if(${PACKAGE}_OPTIONS)
826 find_package(${PACKAGE} ${${PACKAGE}_OPTIONS})
827 elseif(${PACKAGE}_REQUIRED)
828 find_package(${PACKAGE} REQUIRED)
830 find_package(${PACKAGE})
832 if (${PACKAGE_VAR}_FOUND)
833 message(STATUS "${PACKAGE_VAR} FOUND")
834 set(HAVE_LIB${PACKAGE_VAR} 1)
835 include_directories(SYSTEM ${${PACKAGE_VAR}_INCLUDE_DIRS})
836 set(WS_ALL_LIBS ${WS_ALL_LIBS} ${${PACKAGE_VAR}_LIBRARIES})
837 message(STATUS "${PACKAGE} includes: ${${PACKAGE_VAR}_INCLUDE_DIRS}")
838 message(STATUS "${PACKAGE} libs: ${${PACKAGE_VAR}_LIBRARIES}")
839 if (${PACKAGE}_DEFINITIONS)
840 message(STATUS "${PACKAGE} definitions: ${${PACKAGE_VAR}_DEFINITIONS}")
842 if (${PACKAGE_VAR}_EXECUTABLE)
843 message(STATUS "${PACKAGE} executable: ${${PACKAGE_VAR}_EXECUTABLE}")
847 # Not finding a package is only a fatal error if the
848 # package is required; if it's required, then its
849 # XXX_REQUIRED variable is set to TRUE, and the above
850 # code will pass REQUIRED to find_package, and the
851 # configure will fail if the package isn't found.
853 # Do *NOT* report this as an error!
855 message(STATUS "${PACKAGE_VAR} NOT FOUND")
859 # Provide Windows system lib names
860 include( UseWinLibs )
863 include(CPackConfig.txt)
887 if(NOT HAVE_LIBCARES AND NOT HAVE_LIBADNS)
888 # We should make this an error at some point.
889 message(WARNING "Not using c-ares or ADNS.")
890 message(WARNING "Synchronous name resolution can seriously degrade performance.")
892 if(HAVE_LIBNL AND HAVE_AIRPCAP)
893 message(ERROR "Airpcap and Libnl support are mutually exclusive")
898 if(EXTCAP_ANDROIDDUMP_LIBPCAP)
899 set(ANDROIDDUMP_USE_LIBPCAP 1)
902 if (HAVE_LIBWINSPARKLE)
903 set(HAVE_SOFTWARE_UPDATE 1)
906 # No matter which version of GTK is present
907 if(GTK2_FOUND OR GTK3_FOUND)
910 # That's the name autofoo uses
913 # Always include the "true" zlib includes first. This works around a
914 # bug in the Windows setup of GTK[23] which has a faulty zconf.h.
915 include_directories(BEFORE ${ZLIB_INCLUDE_DIRS})
917 if (Qt5Widgets_FOUND)
919 # Qt5CoreConfigExtras.cmake in Qt 5.5.0 sets -fPIC unconditionally:
921 # https://bugreports.qt.io/browse/QTBUG-47942
923 # There's a fix in Gerrit for that:
925 # https://codereview.qt-project.org/#/c/139645/
927 # Do the same check as that fix does and, if the check says we
928 # should *not* add -fPIC, remove it.
930 # XXX - if that check gets changed in the future, we'll have to
931 # detect that and change it.
933 if (CMAKE_VERSION VERSION_LESS 2.8.12
934 AND (CMAKE_CXX_COMPILER_ID STREQUAL \"GNU\"
935 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))
937 # Yes, it should have been; leave it there.
941 # No, it shouldn't have been; remove it.
943 list(REMOVE_ITEM Qt5Widgets_EXECUTABLE_COMPILE_FLAGS "-fPIC")
945 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
947 set (QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES})
948 if(Qt5Multimedia_FOUND)
949 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5Multimedia_LIBRARIES})
950 # That's the name autofoo uses
951 set(QT_MULTIMEDIA_LIB 1)
954 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5Svg_LIBRARIES})
955 # That's the name autofoo uses
958 if(Qt5MacExtras_FOUND)
959 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5MacExtras_LIBRARIES})
960 # That's the name autofoo uses
961 set(QT_MACEXTRAS_LIB 1)
963 if(Qt5WinExtras_FOUND)
964 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5WinExtras_LIBRARIES})
965 # set(QT_WINEXTRAS_LIB 1) # Not needed?
967 if(NOT DEFINED MOC_OPTIONS)
968 set(MOC_OPTIONS --no-notes)
970 # If Qt4: QT_LIBRARIES and QT_INCLUDES are not set above. They require extra magic
972 include(${QT_USE_FILE})
973 include_directories(${QT_INCLUDE_DIR})
974 message(STATUS "Qt includes: ${QT_INCLUDE_DIR}")
975 message(STATUS "Qt libs: ${QT_LIBRARIES}")
976 if(QT_QTMULTIMEDIA_FOUND)
977 include_directories(${QT_QTMULTIMEDIA_INCLUDE_DIR})
978 message(STATUS "QtMultimedia includes: ${QT_INCLUDE_DIR}")
979 set (QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMULTIMEDIA_LIBRARY})
980 message(STATUS "QtMultimedia libs: ${QT_QTMULTIMEDIA_LIBRARY}")
981 # That's the name autofoo uses
982 set(QT_MULTIMEDIA_LIB 1)
984 if(NOT DEFINED MOC_OPTIONS)
985 if(QT_VERSION_MAJOR EQUAL 4 AND QT_VERSION_MINOR GREATER 7)
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( randpkt_core )
1021 add_subdirectory( tools/lemon )
1022 add_subdirectory( ui )
1023 add_subdirectory( wiretap )
1024 add_subdirectory( wsutil )
1027 add_custom_target(dumpabi DEPENDS dumpabi-libwireshark dumpabi-libwiretap dumpabi-libwsutil)
1031 add_subdirectory( echld )
1034 if(BUILD_wireshark_gtk AND GTK_FOUND)
1035 add_subdirectory( ui/gtk )
1038 if(BUILD_wireshark AND QT_FOUND)
1039 add_subdirectory( ui/qt )
1042 # Location of our data files. This should be set to a value that allows
1043 # running from the build directory on Windows, on OS X when building an
1044 # application bundle, and on UNIX if WIRESHARK_RUN_FROM_BUILD_DIRECTORY
1046 if(ENABLE_APPLICATION_BUNDLE)
1047 set(_datafile_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Resources/share/wireshark")
1049 get_target_property(_libwireshark_location epan LOCATION)
1050 get_filename_component(_datafile_dir "${_libwireshark_location}" PATH)
1053 set(DATAFILE_DIR ${_datafile_dir} CACHE INTERNAL "Build time data file location.")
1056 # Target platform locations
1057 # UNIX, Linux, non-bundled OS X: $DESTDIR/lib/wireshark/extcap
1058 # Windows: $DESTDIR/extcap
1059 # OS X app bundle: Wireshark.app/Contents/Resources/share/wireshark/extcap
1062 set(EXTCAP_DIR "extcap")
1064 set(EXTCAP_DIR "${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/extcap")
1069 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LIBSSH_LIBRARIES})
1070 CHECK_FUNCTION_EXISTS(ssh_userauth_agent LIBSSH_USERAUTH_AGENT_FOUND)
1071 if(LIBSSH_USERAUTH_AGENT_FOUND)
1072 set(HAVE_SSH_USERAUTH_AGENT 1)
1076 # Location of our plugins. PLUGIN_DIRECTORY should allow running
1077 # from the build directory similar to DATAFILE_DIR above.
1079 # Target platform locations
1080 # UNIX, Linux, non-bundled OS X: $DESTDIR/lib/wireshark/plugins/$VERSION
1081 # Windows: $DESTDIR/wireshark/plubins/$VERSION
1082 # OS X app bundle: Wireshark.app/Contents/PlugIns/wireshark
1084 add_custom_target(plugins)
1085 set_target_properties(plugins PROPERTIES FOLDER "Plugins")
1087 set(PLUGIN_INSTALL_DIR "plugins/${CPACK_PACKAGE_VERSION}")
1089 set(PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}")
1105 ${CUSTOM_PLUGIN_SRC_DIR}
1107 # It seems this stuff doesn't build with autofoo either...
1109 # set(PLUGIN_SRC_DIRS
1110 # ${PLUGIN_SRC_DIRS}
1115 set(PLUGIN_SRC_DIRS )
1118 if(ENABLE_APPLICATION_BUNDLE)
1119 set(_plugin_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/PlugIns/wireshark")
1121 get_target_property(_libwireshark_location epan LOCATION)
1122 get_filename_component(_plugin_dir "${_libwireshark_location}" PATH)
1123 set(_plugin_dir "${_plugin_dir}/plugins")
1125 # XXX The NMake environment appends the version. Should we do so here?
1126 set (PLUGIN_DIR ${_plugin_dir} CACHE INTERNAL "Build time plugin location.")
1128 foreach(_plugin_src_dir ${PLUGIN_SRC_DIRS})
1129 add_subdirectory( ${_plugin_src_dir} )
1133 # Basedir where to install guides
1134 set(DOC_DIR "$ENV{docdir}" CACHE FILEPATH "Installation directory for ug and dg pdfs.")
1135 message(STATUS "docdir: ${DOC_DIR}")
1137 if(ENABLE_PCAP_NG_DEFAULT)
1138 set(PCAP_NG_DEFAULT 1)
1141 # Large file support (e.g. make off_t 64 bit if supported)
1142 include(gmxTestLargeFiles)
1143 gmx_test_large_files(GMX_LARGEFILES)
1145 add_definitions( -DTOP_SRCDIR=\"${CMAKE_SOURCE_DIR}\" )
1148 set(WS_MSVC_NORETURN "__declspec(noreturn)")
1150 # Disable deprecation
1151 if(MSVC80 OR MSVC90)
1152 add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
1155 set(WS_MSVC_NORETURN " ")
1158 if (${GIT_EXECUTABLE})
1159 set(GIT_BIN_PARAM "--git-bin ${GIT_EXECUTABLE}")
1161 set( VERSION ${PROJECT_VERSION} )
1163 COMMAND ${PERL_EXECUTABLE}
1164 ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
1165 --print-vcs ${GIT_BIN_PARAM}
1166 ${CMAKE_CURRENT_SOURCE_DIR}
1167 OUTPUT_VARIABLE VERSION_H_CONTENT
1169 set( configure_input "Built with CMake ${CMAKE_VERSION}" )
1170 configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h)
1171 configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_BINARY_DIR}/version.h)
1172 #set_target_properties(${CMAKE_BINARY_DIR}/version.h PROPERTIES FOLDER "Auxiliary")
1174 set( prefix "${CMAKE_INSTALL_PREFIX}" )
1175 set( exec_prefix "\${prefix}" )
1176 set( libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}" )
1177 set( includedir "\${prefix}/include" )
1178 set( plugindir "\${libdir}/wireshark/plugins/${CPACK_PACKAGE_VERSION}" )
1180 set(ICON_PATH "${CMAKE_SOURCE_DIR}/image/")
1183 capchild/doxygen.cfg.in
1184 caputils/doxygen.cfg.in
1188 image/libwireshark.rc.in
1189 image/text2pcap.rc.in
1190 image/capinfos.rc.in
1191 image/wireshark.rc.in
1192 image/mergecap.rc.in
1195 image/reordercap.rc.in
1196 image/rawshark.rc.in
1197 image/file_dlg_win32.rc
1201 image/libwscodecs.rc.in
1202 image/libwsutil.rc.in
1204 image/wireshark.exe.manifest.in
1205 packaging/macosx/Info.plist.in
1206 packaging/macosx/osx-dmg.sh.in
1207 packaging/macosx/Wireshark_package.pmdoc/index.xml.in
1208 randpkt_core/doxygen.cfg.in
1210 ui/gtk/doxygen.cfg.in
1211 ui/qt/doxygen.cfg.in
1214 foreach( _in_file ${IN_FILES} )
1215 get_filename_component( _path ${_in_file} PATH )
1216 string( REGEX REPLACE "(.*)\\.in" "\\1" _outfile ${_in_file} )
1217 configure_file( ${CMAKE_SOURCE_DIR}/${_in_file} ${CMAKE_BINARY_DIR}/${_outfile} @ONLY )
1220 include(FeatureSummary)
1221 #SET_FEATURE_INFO(NAME DESCRIPTION [URL [COMMENT] ])
1222 SET_FEATURE_INFO(SBC "SBC Codec for Bluetooth A2DP stream playing" "www: http://git.kernel.org/cgit/bluetooth/sbc.git" )
1223 SET_FEATURE_INFO(LIBSSH "libssh is library for ssh connections and it is needed to build sshdump" "www: https://www.libssh.org/get-it/" )
1225 FEATURE_SUMMARY(WHAT ALL)
1228 ${CMAKE_BINARY_DIR}/ui
1229 ${CMAKE_BINARY_DIR}/ui/gtk
1230 ${CMAKE_BINARY_DIR}/ui/qt
1231 ${CMAKE_BINARY_DIR}/capchild
1232 ${CMAKE_BINARY_DIR}/caputils
1233 ${CMAKE_BINARY_DIR}/codecs
1234 ${CMAKE_BINARY_DIR}/epan
1235 ${CMAKE_BINARY_DIR}/randpkt_core
1236 ${CMAKE_BINARY_DIR}/wiretap
1237 ${CMAKE_BINARY_DIR}/wsutil
1242 ui/win32/console_win32.c
1243 ui/win32/file_dlg_win32.c
1244 ui/win32/print_win32.c
1246 set(PLATFORM_UI_RC_FILES
1247 image/file_dlg_win32.rc
1251 # sources common for wireshark, tshark, and rawshark
1252 set(SHARK_COMMON_SRC
1258 # sources for external capture interfaces
1260 set(SHARK_COMMON_SRC
1268 ui/cli/tap-camelsrt.c
1269 ui/cli/tap-comparestat.c
1270 ui/cli/tap-diameter-avp.c
1272 ui/cli/tap-endpoints.c
1275 ui/cli/tap-gsm_astat.c
1277 ui/cli/tap-httpstat.c
1278 ui/cli/tap-icmpstat.c
1279 ui/cli/tap-icmpv6stat.c
1281 ui/cli/tap-iousers.c
1282 ui/cli/tap-macltestat.c
1283 ui/cli/tap-protocolinfo.c
1284 ui/cli/tap-protohierstat.c
1285 ui/cli/tap-rlcltestat.c
1286 ui/cli/tap-rpcprogs.c
1289 ui/cli/tap-rtspstat.c
1290 ui/cli/tap-sctpchunkstat.c
1291 ui/cli/tap-simple_stattable.c
1292 ui/cli/tap-sipstat.c
1293 ui/cli/tap-smbsids.c
1295 ui/cli/tap-stats_tree.c
1297 ui/cli/tap-wspstat.c
1310 ${CMAKE_BINARY_DIR}/androiddump.html
1311 ${CMAKE_BINARY_DIR}/sshdump.html
1312 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
1313 ${CMAKE_BINARY_DIR}/capinfos.html
1314 ${CMAKE_BINARY_DIR}/captype.html
1318 ${CMAKE_BINARY_DIR}/dftest.html
1319 ${CMAKE_BINARY_DIR}/dumpcap.html
1320 ${CMAKE_BINARY_DIR}/editcap.html
1321 ${CMAKE_BINARY_DIR}/extcap.html
1322 ${CMAKE_BINARY_DIR}/asn2deb.html
1323 ${CMAKE_BINARY_DIR}/idl2deb.html
1324 ${CMAKE_BINARY_DIR}/idl2wrs.html
1327 ${CMAKE_BINARY_DIR}/mergecap.html
1329 ${CMAKE_BINARY_DIR}/randpkt.html
1330 ${CMAKE_BINARY_DIR}/randpktdump.html
1331 ${CMAKE_BINARY_DIR}/rawshark.html
1332 ${CMAKE_BINARY_DIR}/reordercap.html
1335 ${CMAKE_BINARY_DIR}/text2pcap.html
1336 ${CMAKE_BINARY_DIR}/tshark.html
1337 ${CMAKE_BINARY_DIR}/wireshark-filter.html
1338 ${CMAKE_BINARY_DIR}/wireshark.html
1343 set(TEXTIFY_FILES COPYING NEWS README README.windows)
1344 foreach(_text_file ${TEXTIFY_FILES})
1345 set(INSTALL_FILES ${CMAKE_BINARY_DIR}/${_text_file}.txt ${INSTALL_FILES})
1348 set(INSTALL_FILES COPYING ${INSTALL_FILES})
1352 ${CMAKE_BINARY_DIR}/androiddump.1
1353 ${CMAKE_BINARY_DIR}/capinfos.1
1354 ${CMAKE_BINARY_DIR}/captype.1
1355 ${CMAKE_BINARY_DIR}/dftest.1
1356 ${CMAKE_BINARY_DIR}/dumpcap.1
1357 ${CMAKE_BINARY_DIR}/editcap.1
1358 ${CMAKE_BINARY_DIR}/extcap.4
1359 ${CMAKE_BINARY_DIR}/idl2wrs.1
1360 ${CMAKE_BINARY_DIR}/mergecap.1
1361 ${CMAKE_BINARY_DIR}/randpkt.1
1362 ${CMAKE_BINARY_DIR}/androiddump.1
1363 ${CMAKE_BINARY_DIR}/rawshark.1
1364 ${CMAKE_BINARY_DIR}/reordercap.1
1365 ${CMAKE_BINARY_DIR}/sshdump.1
1366 ${CMAKE_BINARY_DIR}/text2pcap.1
1367 ${CMAKE_BINARY_DIR}/tshark.1
1368 ${CMAKE_BINARY_DIR}/wireshark.1
1372 ${CMAKE_BINARY_DIR}/wireshark-filter.4
1376 # @NSL_LIBS@ # -lnsl
1377 # @SOCKET_LIBS@ # -lsocket
1378 # @SSL_LIBS@ # -lcrypto
1380 # $(plugin_ldadd) # in case of static
1381 ${AIRPCAP_LIBRARIES}
1385 ${KERBEROS_LIBRARIES}
1394 ${WINSPARKLE_LIBRARIES}
1398 # According to http://stackoverflow.com/questions/14474659/cmake-how-to-have-a-target-for-copying-files
1399 # we can't just use "set(_dll_output_dir "$<TARGET_FILE_DIR:epan>")"
1400 # DATAFILE_DIR is set using the same property. We could probably
1401 # get away with using it here.
1402 get_target_property(_libwireshark_location epan LOCATION)
1403 get_filename_component(_dll_output_dir "${_libwireshark_location}" PATH)
1404 add_custom_target(copy_cli_dlls)
1405 set_target_properties(copy_cli_dlls PROPERTIES FOLDER "Copy Tasks")
1406 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1407 COMMAND ${CMAKE_COMMAND} -E make_directory "${_dll_output_dir}"
1410 # XXX Can (and should) we iterate over these similar to the way
1411 # the top-level CMakeLists.txt iterates over the package list?
1414 # The cairo, freetype, gio, gnutls, png, and other OBS-generated DLLs
1415 # depend on zlib1.dll. We compile zlib locally but the Debug
1416 # configuration (the default) creates zlibd1.dll.
1417 file (TO_NATIVE_PATH "${_dll_output_dir}" _dll_output_dir_win )
1418 foreach( _dll ${GLIB2_DLLS} $<$<CONFIG:Debug>:zlib1.dll> )
1419 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1420 # It would be really handy if copy, xcopy, or "cmake
1421 # -E copy_if_different" supported multiple files
1422 # separated by whitespace, or if robocpy had a sane
1423 # notion of exit codes.
1424 COMMAND if exist \"${_dll}\" xcopy ${_dll} "${_dll_output_dir_win}" /D /Y
1425 WORKING_DIRECTORY "${GLIB2_DLL_DIR}"
1430 # Don't overwrite an exe if it's already there. We don't want to
1431 # clobber any previous code signing.
1432 file(GLOB _gspawn_helpers
1433 RELATIVE "${GLIB2_DLL_DIR}"
1434 "${GLIB2_DLL_DIR}/gspawn*.exe"
1436 foreach(_gspawn_helper ${_gspawn_helpers})
1437 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1438 COMMAND if not exist \"${_dll_output_dir_win}\\${_gspawn_helper}\" xcopy ${_gspawn_helper} "${_dll_output_dir_win}" /D /Y
1439 WORKING_DIRECTORY "${GLIB2_DLL_DIR}"
1445 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1446 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1447 "${AIRPCAP_DLL_DIR}/${AIRPCAP_DLL}"
1448 "${_dll_output_dir}"
1450 endif(AIRPCAP_FOUND)
1452 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1453 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1454 "${CARES_DLL_DIR}/${CARES_DLL}"
1455 "${_dll_output_dir}"
1459 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1460 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1461 "${GEOIP_DLL_DIR}/${GEOIP_DLL}"
1462 "${_dll_output_dir}"
1466 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1467 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1468 "${LIBSSH_DLL_DIR}/${LIBSSH_DLL}"
1469 "${_dll_output_dir}"
1473 foreach( _dll ${GCRYPT_DLLS} )
1474 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1475 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1476 "${GCRYPT_DLL_DIR}/${_dll}"
1477 "${_dll_output_dir}"
1482 foreach( _dll ${GNUTLS_DLLS} )
1483 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1484 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1485 "${GNUTLS_DLL_DIR}/${_dll}"
1486 "${_dll_output_dir}"
1491 foreach( _dll ${KERBEROS_DLLS} )
1492 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1493 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1494 "${KERBEROS_DLL_DIR}/${_dll}"
1495 "${_dll_output_dir}"
1498 endif(KERBEROS_FOUND)
1500 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1501 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1502 "${LUA_DLL_DIR}/${LUA_DLL}"
1503 "${_dll_output_dir}"
1507 # Wireshark.nsi wants SMI_DIR which is the base SMI directory
1508 get_filename_component(SMI_DIR ${SMI_DLL_DIR} DIRECTORY)
1509 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1510 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1511 "${SMI_DLL_DIR}/${SMI_DLL}"
1512 "${_dll_output_dir}"
1513 COMMAND ${CMAKE_COMMAND} -E make_directory
1514 "${_dll_output_dir}/snmp"
1515 COMMAND ${CMAKE_COMMAND} -E make_directory
1516 "${_dll_output_dir}/snmp/mibs"
1517 COMMAND ${CMAKE_COMMAND} -E copy_directory
1518 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/iana"
1519 "${_dll_output_dir}/snmp/mibs"
1520 COMMAND ${CMAKE_COMMAND} -E copy_directory
1521 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/ietf"
1522 "${_dll_output_dir}/snmp/mibs"
1523 COMMAND ${CMAKE_COMMAND} -E copy_directory
1524 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/irtf"
1525 "${_dll_output_dir}/snmp/mibs"
1526 COMMAND ${CMAKE_COMMAND} -E copy_directory
1527 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/site"
1528 "${_dll_output_dir}/snmp/mibs"
1529 COMMAND ${CMAKE_COMMAND} -E copy_directory
1530 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/tubs"
1531 "${_dll_output_dir}/snmp/mibs"
1532 COMMAND ${CMAKE_COMMAND} -E copy_directory
1533 "${SMI_SHARE_DIR}/${SMI_DLL}/pibs"
1534 "${_dll_output_dir}/snmp/mibs"
1535 COMMAND ${CMAKE_COMMAND} -E copy_directory
1536 "${SMI_SHARE_DIR}/${SMI_DLL}/yang"
1537 "${_dll_output_dir}/snmp/mibs"
1540 if (WINSPARKLE_FOUND)
1541 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1542 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1543 "${WINSPARKLE_DLL_DIR}/${WINSPARKLE_DLL}"
1544 "${_dll_output_dir}"
1546 endif(WINSPARKLE_FOUND)
1548 add_dependencies(epan copy_cli_dlls)
1550 # We have a lot of choices for creating zip archives:
1551 # - 7z, WinZip, etc., which require a separate download+install.
1552 # - Cygwin's zip, which requires Cygwin.
1553 # - "CMake -E tar cz", which creates a tar file.
1554 # - CPack, which requires a CPack configuration.
1555 # - PowerShell via PSCX or System.IO.Compression.FileSystem.
1556 # - Python via zipfile.
1557 # For now, just look for 7z. It's installed on the Windows builders,
1558 # which might be the only systems that use this target.
1559 find_program(ZIP_EXECUTABLE 7z
1560 PATH "$ENV{PROGRAMFILES}/7-Zip" "$ENV{PROGRAMW6432}/7-Zip"
1561 DOC "Path to the 7z utility."
1563 # XXX "if(ZIP_EXECUTABLE)" doesn't work here. It looks like the
1564 # absence of "-NOTFOUND" doesn't equal "true".
1565 if (NOT "${ZIP_EXECUTABLE}" STREQUAL "ZIP_EXECUTABLE-NOTFOUND")
1566 add_custom_target(pdb_zip_package)
1567 set_target_properties(pdb_zip_package PROPERTIES FOLDER "Packaging")
1568 set(_pdb_zip "${CMAKE_BINARY_DIR}/Wireshark-pdb-${WIRESHARK_TARGET_PLATFORM}-${VERSION}.zip")
1569 file(TO_NATIVE_PATH "${_pdb_zip}" _pdb_zip_win)
1570 add_custom_command(TARGET pdb_zip_package POST_BUILD
1571 COMMAND ${CMAKE_COMMAND} -E remove -f "${_pdb_zip}"
1572 COMMAND ${ZIP_EXECUTABLE} a -tzip -mmt=on "${_pdb_zip_win}" *.pdb *.lib
1573 WORKING_DIRECTORY "${_dll_output_dir}"
1575 add_dependencies(pdb_zip_package epan)
1579 # List of extra dependencies for the "copy_data_files" target
1580 set(copy_data_files_depends)
1582 # glob patterns relative to the source directory that should be copied to
1583 # ${DATAFILE_DIR} (including directory prefixes)
1589 foreach(_text_file ${TEXTIFY_FILES})
1590 add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${_text_file}.txt
1591 COMMAND ${POWERSHELL_COMMAND} "${CMAKE_SOURCE_DIR}/tools/textify.ps1"
1592 -Destination ${CMAKE_BINARY_DIR}
1593 ${CMAKE_SOURCE_DIR}/${_text_file}
1595 ${CMAKE_SOURCE_DIR}/${_text_file}
1600 foreach(_install_file ${INSTALL_FILES})
1601 get_filename_component(_install_basename "${_install_file}" NAME)
1602 set(_output_file "${DATAFILE_DIR}/${_install_basename}")
1603 add_custom_command(OUTPUT "${_output_file}"
1604 COMMAND ${CMAKE_COMMAND} -E copy
1607 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
1612 list(APPEND copy_data_files_depends "${_output_file}")
1616 # Ensure "run/extcap" exists
1617 add_custom_command(OUTPUT "${DATAFILE_DIR}/extcap"
1618 COMMAND ${CMAKE_COMMAND} -E make_directory
1619 "${DATAFILE_DIR}/extcap"
1621 list(APPEND copy_data_files_depends "${DATAFILE_DIR}/extcap")
1624 help/capture_filters.txt
1626 help/display_filters.txt
1627 help/getting_started.txt
1631 file(TO_NATIVE_PATH "${DATAFILE_DIR}/help" _help_dest_dir)
1632 foreach(_help_file IN LISTS _help_files)
1633 add_custom_command(OUTPUT "${DATAFILE_DIR}/${_help_file}"
1634 COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/help"
1635 COMMAND ${POWERSHELL_COMMAND} "${CMAKE_SOURCE_DIR}/tools/textify.ps1"
1636 -Destination "${_help_dest_dir}"
1637 "${CMAKE_SOURCE_DIR}/${_help_file}"
1639 "${CMAKE_SOURCE_DIR}/${_help_file}"
1641 list(APPEND copy_data_files_depends "${DATAFILE_DIR}/${_help_file}")
1644 list(APPEND DATA_FILES_SRC ${_help_files})
1647 # Create help/faq.txt when missing
1648 add_custom_command(OUTPUT "${DATAFILE_DIR}/help/faq.txt"
1649 COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/help"
1650 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/help/faq.py -b > faq.tmp.html
1651 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/html2text.py
1652 faq.tmp.html > "${DATAFILE_DIR}/help/faq.txt"
1653 COMMAND ${CMAKE_COMMAND} -E remove faq.tmp.html
1655 "${CMAKE_SOURCE_DIR}/help/faq.py"
1656 "${CMAKE_SOURCE_DIR}/tools/html2text.py"
1658 list(APPEND copy_data_files_depends "${DATAFILE_DIR}/help/faq.txt")
1660 # Install LUA files in staging directory such that LUA can used when Wireshark
1661 # is ran from the build directory. For install targets, see
1662 # epan/wslua/CMakeLists.txt
1663 if(LUA_FOUND AND ENABLE_LUA)
1665 "${CMAKE_BINARY_DIR}/epan/wslua/init.lua"
1666 "${CMAKE_SOURCE_DIR}/epan/wslua/console.lua"
1667 "${CMAKE_SOURCE_DIR}/epan/wslua/dtd_gen.lua"
1669 foreach(_lua_file ${_lua_files})
1670 get_filename_component(_lua_filename "${_lua_file}" NAME)
1671 list(APPEND copy_data_files_depends
1672 "${DATAFILE_DIR}/${_lua_filename}")
1673 add_custom_command(OUTPUT "${DATAFILE_DIR}/${_lua_filename}"
1674 COMMAND ${CMAKE_COMMAND} -E copy
1676 "${DATAFILE_DIR}/${_lua_filename}"
1682 endif(LUA_FOUND AND ENABLE_LUA)
1683 # doc/*.html handled elsewhere.
1685 # TODO shouldn't this use full (relative) paths instead of glob patterns?
1686 list(APPEND DATA_FILES_SRC
1689 "radius/README.radius_dictionary"
1690 "radius/custom.includes"
1692 "radius/dictionary.*"
1702 # Copy all paths from the source tree to the data directory. Directories are
1703 # automatically created if missing as the filename is given.
1704 file(GLOB _data_files RELATIVE "${CMAKE_SOURCE_DIR}" ${DATA_FILES_SRC})
1705 foreach(_data_file ${_data_files})
1706 add_custom_command(OUTPUT "${DATAFILE_DIR}/${_data_file}"
1707 COMMAND ${CMAKE_COMMAND} -E copy
1708 "${CMAKE_SOURCE_DIR}/${_data_file}"
1709 "${DATAFILE_DIR}/${_data_file}"
1711 "${CMAKE_SOURCE_DIR}/${_data_file}"
1713 list(APPEND copy_data_files_depends "${DATAFILE_DIR}/${_data_file}")
1716 # Copy files including ${INSTALL_FILES} and ${INSTALL_DIRS} to ${DATAFILE_DIR}
1717 add_custom_target(copy_data_files ALL DEPENDS ${copy_data_files_depends})
1718 set_target_properties(copy_data_files PROPERTIES FOLDER "Copy Tasks")
1720 if( (BUILD_wireshark AND QT_FOUND) OR (BUILD_wireshark_gtk AND GTK_FOUND) )
1733 ${CMAKE_BINARY_DIR}/image/wireshark.rc
1734 ${PLATFORM_UI_RC_FILES}
1738 if(ENABLE_APPLICATION_BUNDLE)
1740 # Add -Wl,-single_module to the LDFLAGS used with shared
1741 # libraries, to fix some error that show up in some cases;
1742 # some Apple documentation recommends it for most shared
1745 set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-single_module ${CMAKE_SHARED_LINKER_FLAGS}" )
1747 # Add -Wl,-headerpad_max_install_names to the LDFLAGS, as
1748 # code-signing issues is running out of padding space.
1750 # Add -Wl,-search_paths_first to make sure that if we search
1751 # directories A and B, in that order, for a given library, a
1752 # non-shared version in directory A, rather than a shared
1753 # version in directory B, is chosen (so we can use
1754 # --with-pcap=/usr/local to force all programs to be linked
1755 # with a static version installed in /usr/local/lib rather than
1756 # the system version in /usr/lib).
1759 set(CMAKE_EXE_LINKER_FLAGS
1760 "-Wl,-headerpad_max_install_names -Wl,-search_paths_first ${CMAKE_EXE_LINKER_FLAGS}"
1763 # Add files to the app bundle
1764 # Wireshark.app/Contents
1765 file(WRITE ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo "APPLWshk\n")
1766 set(BUNDLE_CONTENTS_FILES
1767 ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo
1769 set_source_files_properties(${BUNDLE_CONTENTS_FILES} PROPERTIES
1770 MACOSX_PACKAGE_LOCATION .
1773 # Wireshark.app/Contents/Resources
1774 set(BUNDLE_RESOURCE_FILES
1775 ${CMAKE_SOURCE_DIR}/packaging/macosx/Resources/Wireshark.icns
1776 ${CMAKE_SOURCE_DIR}/packaging/macosx/Resources/Wiresharkdoc.icns
1778 set_source_files_properties(${BUNDLE_RESOURCE_FILES} PROPERTIES
1779 MACOSX_PACKAGE_LOCATION Resources
1782 # Wireshark.app/Contents/Resources/share/man/man1
1783 set(BUNDLE_RESOURCE_SHARE_MAN1_FILES ${MAN1_FILES})
1784 set_source_files_properties(${BUNDLE_RESOURCE_SHARE_MAN1_FILES} PROPERTIES
1785 MACOSX_PACKAGE_LOCATION Resources/share/man/man1
1788 # Wireshark.app/Contents/Resources/share/man/man1
1789 set(BUNDLE_RESOURCE_SHARE_MAN4_FILES ${MAN4_FILES})
1790 set_source_files_properties(${BUNDLE_RESOURCE_SHARE_MAN4_FILES} PROPERTIES
1791 MACOSX_PACKAGE_LOCATION Resources/share/man/man4
1794 # INSTALL_FILES and INSTALL_DIRS are handled by copy_data_files
1796 set(EXTRA_BUNDLE_FILES
1797 ${BUNDLE_CONTENTS_FILES}
1798 ${BUNDLE_RESOURCE_FILES}
1799 ${BUNDLE_RESOURCE_SHARE_MAN1_FILES}
1800 ${BUNDLE_RESOURCE_SHARE_MAN4_FILES}
1803 set(EXTRA_BUNDLE_FILES)
1806 if(BUILD_wireshark AND QT_FOUND)
1813 ${GTHREAD2_LIBRARIES}
1816 ${APPLE_APPLICATION_SERVICES_LIBRARY}
1817 ${APPLE_CORE_FOUNDATION_LIBRARY}
1818 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
1822 # Policy since 2.8.11
1824 cmake_policy(SET CMP0020 NEW)
1827 add_executable(wireshark WIN32 MACOSX_BUNDLE wireshark-qt.cpp ${wireshark_FILES} ${EXTRA_BUNDLE_FILES})
1828 set(PROGLIST ${PROGLIST} wireshark)
1829 set_target_properties(wireshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1830 set_target_properties(wireshark PROPERTIES FOLDER "Executables")
1831 if(ENABLE_APPLICATION_BUNDLE OR WIN32)
1832 set_target_properties(wireshark PROPERTIES OUTPUT_NAME Wireshark)
1835 if(ENABLE_APPLICATION_BUNDLE)
1836 set_target_properties(
1837 wireshark PROPERTIES
1838 MACOSX_BUNDLE_INFO_PLIST ${CMAKE_BINARY_DIR}/packaging/macosx/Info.plist
1840 # Add a wrapper script which opens the bundle. This adds
1841 # convenience but makes debugging more difficult.
1842 file(REMOVE ${CMAKE_BINARY_DIR}/run/wireshark)
1843 file(WRITE ${CMAKE_BINARY_DIR}/run/wireshark "#!/bin/sh\n")
1844 file(APPEND ${CMAKE_BINARY_DIR}/run/wireshark "open ${CMAKE_BINARY_DIR}/run/Wireshark.app --args \"\$\@\"\n")
1845 execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/wireshark)
1848 target_link_libraries(wireshark ${wireshark_LIBS})
1851 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1852 BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
1855 if(NOT ENABLE_APPLICATION_BUNDLE)
1856 # Map for endpoints dialog
1860 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1861 "${PROJECT_SOURCE_DIR}/ipmap.html"
1862 $<TARGET_FILE_DIR:wireshark>
1866 if(WIN32 AND Qt5Core_FOUND)
1867 # Use windeployqt to copy our required DLLs to the run path.
1868 # Ideally one of the modules in ${QTDIR}/lib/cmake would expose
1869 # the path to windeployqt. For that matter having a reliable
1870 # path to qmake would be *amazingly convenient*. We don't have
1871 # either of those so we try to discover the path via Qt5Core.
1872 # http://stackoverflow.com/questions/24650936/qt5-with-cmake-how-to-find-qt-translations-dir
1874 get_target_property(_qmake_location Qt5::qmake IMPORTED_LOCATION)
1875 get_filename_component(_qt_bin_path "${_qmake_location}" DIRECTORY)
1876 find_program(QT_WINDEPLOYQT_EXECUTABLE windeployqt
1877 HINTS "${_qmake_location}"
1878 DOC "Path to the windeployqt utility."
1880 if (NOT "${QT_WINDEPLOYQT_EXECUTABLE}" STREQUAL "QT_WINDEPLOYQT_EXECUTABLE-NOTFOUND")
1881 set(QT_BIN_PATH "${_qt_bin_path}" CACHE INTERNAL
1882 "Path to qmake, windeployqt, and other Qt utilities."
1884 add_custom_target(copy_qt_dlls ALL)
1885 set_target_properties(copy_qt_dlls PROPERTIES FOLDER "Copy Tasks")
1886 # Will we ever need to use --debug? Windeployqt seems to
1887 # be smart enough to copy debug DLLs when needed.
1888 add_custom_command(TARGET copy_qt_dlls
1890 COMMAND set "PATH=%PATH%;${QT_BIN_PATH}"
1891 COMMAND "${QT_WINDEPLOYQT_EXECUTABLE}"
1892 $<$<CONFIG:Debug>:--debug>
1893 $<$<NOT:$<CONFIG:Debug>>:--release>
1894 --no-compiler-runtime
1896 "$<TARGET_FILE:wireshark>"
1898 add_dependencies(copy_qt_dlls wireshark)
1900 endif(WIN32 AND Qt5Core_FOUND)
1903 # Common properties for CLI executables
1904 macro(set_extra_executable_properties _executable _folder)
1905 set_target_properties(${_executable} PROPERTIES
1906 LINK_FLAGS "${WS_LINK_FLAGS}"
1910 set(PROGLIST ${PROGLIST} ${_executable})
1912 if(ENABLE_APPLICATION_BUNDLE)
1913 set_target_properties(${_executable} PROPERTIES
1914 RUNTIME_OUTPUT_DIRECTORY run/Wireshark.app/Contents/MacOS
1916 # Add a wrapper script which runs each executable from the
1917 # correct location. This adds convenience but makes debugging
1919 file(REMOVE ${CMAKE_BINARY_DIR}/run/${_executable})
1920 file(WRITE ${CMAKE_BINARY_DIR}/run/${_executable} "#!/bin/sh\n")
1921 file(APPEND ${CMAKE_BINARY_DIR}/run/${_executable} "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/${_executable} \"\$\@\"\n")
1922 execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/${_executable})
1926 macro(set_extcap_executable_properties _executable)
1927 set_target_properties(${_executable} PROPERTIES FOLDER "Executables/Extcaps")
1929 set(PROGLIST ${PROGLIST} ${_executable})
1932 set_target_properties(${_executable} PROPERTIES
1933 LINK_FLAGS "${WS_LINK_FLAGS}"
1934 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/extcap
1935 RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/run/Debug/extcap
1936 RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/run/Release/extcap
1937 RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_BINARY_DIR}/run/MinSizeRel/extcap
1938 RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/run/RelWithDebInfo/extcap
1941 set_target_properties(${_executable} PROPERTIES
1942 LINK_FLAGS "${WS_LINK_FLAGS}"
1943 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/extcap
1945 if(ENABLE_APPLICATION_BUNDLE)
1946 set_target_properties(${_executable} PROPERTIES
1947 RUNTIME_OUTPUT_DIRECTORY run/Wireshark.app/Contents/MacOS/extcap
1949 # Add a wrapper script which runs each executable from the
1950 # correct location. This adds convenience but makes debugging
1952 file(REMOVE ${CMAKE_BINARY_DIR}/run/${_executable})
1953 file(WRITE ${CMAKE_BINARY_DIR}/run/${_executable} "#!/bin/sh\n")
1954 file(APPEND ${CMAKE_BINARY_DIR}/run/${_executable} "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/extcap/${_executable} \"\$\@\"\n")
1955 execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/${_executable})
1960 if(BUILD_wireshark_gtk AND GTK_FOUND)
1961 set(wireshark_gtk_LIBS
1968 ${GTHREAD2_LIBRARIES}
1970 ${PORTAUDIO_LIBRARIES}
1972 ${APPLE_APPLICATION_SERVICES_LIBRARY}
1973 ${APPLE_CORE_SERVICES_LIBRARY}
1974 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
1976 ${WIN_COMCTL32_LIBRARY}
1978 # wireshark and wireshark-gtk share wireshark_FILES
1980 add_executable(wireshark-gtk WIN32 ${wireshark_FILES})
1981 set(PROGLIST ${PROGLIST} wireshark-gtk)
1982 set_target_properties(wireshark-gtk PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1983 set_target_properties(wireshark-gtk PROPERTIES FOLDER "Executables")
1984 target_link_libraries(wireshark-gtk ${wireshark_gtk_LIBS})
1985 install(TARGETS wireshark-gtk RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1987 # Map for endpoints dialog
1989 TARGET wireshark-gtk
1991 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1992 "${PROJECT_SOURCE_DIR}/ipmap.html"
1993 $<TARGET_FILE_DIR:wireshark-gtk>
1997 get_target_property(_wsgtk_location wireshark-gtk LOCATION)
1998 get_filename_component(_dll_output_dir "${_wsgtk_location}" PATH)
1999 add_custom_target(copy_gtk_dlls)
2000 set_target_properties(copy_gtk_dlls PROPERTIES FOLDER "Copy Tasks")
2001 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2002 COMMAND ${CMAKE_COMMAND} -E make_directory "${_dll_output_dir}"
2006 set(_gtk_dll_dir "${GTK2_DLL_DIR}")
2007 set(_gtk_etc_dir "${GTK2_ETC_DIR}")
2008 set(_gtk_dlls "${GTK2_DLLS}")
2009 set(_gtk_etc_dir "${GTK2_ETC_DIR}")
2011 set(_gtk_dll_dir "${GTK3_DLL_DIR}")
2012 set(_gtk_dlls "${GTK3_DLLS}")
2013 set(_gtk_etc_dir "${GTK3_ETC_DIR}")
2016 foreach(_dll ${_gtk_dlls})
2017 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2018 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2019 "${_gtk_dll_dir}/${_dll}" "${_dll_output_dir}"
2024 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2025 COMMAND ${CMAKE_COMMAND} -E make_directory "${_dll_output_dir}/etc"
2027 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2028 COMMAND ${CMAKE_COMMAND} -E copy_directory
2029 "${_gtk_etc_dir}" "${_dll_output_dir}/etc"
2032 # XXX - Omitting ${GTK2_LIB_DIR}\loaders copying from Makefile.nmake
2035 set (_engines_output_dir "${_dll_output_dir}/lib/gtk-2.0/2.10.0/engines")
2036 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2037 COMMAND ${CMAKE_COMMAND} -E make_directory "${_engines_output_dir}"
2039 foreach(_dll ${GTK2_ENGINES_DLLS})
2040 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2041 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2042 "${GTK2_ENGINES_DLL_DIR}/${_dll}" "${_engines_output_dir}"
2047 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2048 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2049 "${GTK2_THEMES_DIR}/gtkrc" "${_dll_output_dir}/etc/gtk-2.0"
2053 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2054 COMMAND ${CMAKE_COMMAND} -E copy_directory
2055 "${GTK2_LIB_DIR}" "${_dll_output_dir}/lib/gtk-2.0"
2058 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2059 COMMAND ${CMAKE_COMMAND} -E copy_directory
2060 "${CMAKE_SOURCE_DIR}/ui/win32/settings.ini" "${_dll_output_dir}/etc"
2064 add_dependencies(wireshark-gtk copy_gtk_dlls copy_cli_dlls)
2068 register_tap_files(tshark-tap-register.c
2079 ${APPLE_CORE_FOUNDATION_LIBRARY}
2080 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
2085 tshark-tap-register.c
2089 ${CMAKE_BINARY_DIR}/image/tshark.rc
2091 add_executable(tshark ${tshark_FILES})
2092 set_extra_executable_properties(tshark "Executables")
2093 target_link_libraries(tshark ${tshark_LIBS})
2094 install(TARGETS tshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2101 ${APPLE_CORE_FOUNDATION_LIBRARY}
2102 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
2108 ${CMAKE_BINARY_DIR}/image/tfshark.rc
2110 add_executable(tfshark ${tfshark_FILES})
2111 set_extra_executable_properties(tfshark "Executables")
2112 target_link_libraries(tfshark ${tfshark_LIBS})
2113 install(TARGETS tfshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2116 if(BUILD_rawshark AND PCAP_FOUND)
2120 ${APPLE_CORE_FOUNDATION_LIBRARY}
2121 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
2127 ${CMAKE_BINARY_DIR}/image/rawshark.rc
2129 add_executable(rawshark ${rawshark_FILES})
2130 set_extra_executable_properties(rawshark "Executables")
2131 target_link_libraries(rawshark ${rawshark_LIBS})
2132 install(TARGETS rawshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2143 add_executable(dftest ${dftest_FILES})
2144 set_extra_executable_properties(dftest "Tests")
2145 target_link_libraries(dftest ${dftest_LIBS})
2146 install(TARGETS dftest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2165 add_executable(randpkt ${randpkt_FILES})
2166 set_extra_executable_properties(randpkt "Executables")
2167 target_link_libraries(randpkt ${randpkt_LIBS})
2168 install(TARGETS randpkt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2177 set(text2pcap_CLEAN_FILES
2182 ${text2pcap_CLEAN_FILES}
2183 ${CMAKE_BINARY_DIR}/image/text2pcap.rc
2185 add_lex_files(text2pcap_FILES
2188 add_executable(text2pcap ${text2pcap_FILES})
2189 set_extra_executable_properties(text2pcap "Executables")
2190 target_link_libraries(text2pcap ${text2pcap_LIBS})
2191 install(TARGETS text2pcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2202 ${CMAKE_BINARY_DIR}/image/mergecap.rc
2204 add_executable(mergecap ${mergecap_FILES})
2205 set_extra_executable_properties(mergecap "Executables")
2206 target_link_libraries(mergecap ${mergecap_LIBS})
2207 install(TARGETS mergecap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2210 if(BUILD_reordercap)
2216 set(reordercap_FILES
2218 ${CMAKE_BINARY_DIR}/image/reordercap.rc
2220 add_executable(reordercap ${reordercap_FILES})
2221 set_extra_executable_properties(reordercap "Executables")
2222 target_link_libraries(reordercap ${reordercap_LIBS})
2223 install(TARGETS reordercap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2236 ${CMAKE_BINARY_DIR}/image/capinfos.rc
2238 add_executable(capinfos ${capinfos_FILES})
2239 set_extra_executable_properties(capinfos "Executables")
2240 target_link_libraries(capinfos ${capinfos_LIBS})
2241 install(TARGETS capinfos RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2253 ${CMAKE_BINARY_DIR}/image/captype.rc
2255 add_executable(captype ${captype_FILES})
2256 set_extra_executable_properties(captype "Executables")
2257 target_link_libraries(captype ${captype_LIBS})
2258 install(TARGETS captype RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2269 ${CMAKE_BINARY_DIR}/image/editcap.rc
2271 add_executable(editcap ${editcap_FILES})
2272 set_extra_executable_properties(editcap "Executables")
2273 target_link_libraries(editcap ${editcap_LIBS})
2274 install(TARGETS editcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2277 if(BUILD_dumpcap AND PCAP_FOUND)
2286 ${GTHREAD2_LIBRARIES}
2288 ${APPLE_CORE_FOUNDATION_LIBRARY}
2289 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
2294 capture_stop_conditions.c
2301 ${CMAKE_BINARY_DIR}/image/dumpcap.rc
2303 add_executable(dumpcap ${dumpcap_FILES})
2304 set_extra_executable_properties(dumpcap "Executables")
2305 target_link_libraries(dumpcap ${dumpcap_LIBS})
2306 install(TARGETS dumpcap
2307 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
2308 PERMISSIONS ${DUMPCAP_SETUID}
2309 OWNER_READ OWNER_WRITE OWNER_EXECUTE
2310 GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
2312 if(DUMPCAP_INSTALL_OPTION STREQUAL "capabilities")
2313 install( CODE "execute_process(
2315 ${SETCAP_EXECUTABLE}
2316 cap_net_raw,cap_net_admin+ep
2317 ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/dumpcap${CMAKE_EXECUTABLE_SUFFIX}
2321 if( _SETCAP_RESULT )
2322 message( WARNING \"setcap failed (${_SETCAP_RESULT}).\")
2329 find_package( MSVC_REDIST )
2331 # Must come after executable targets are defined.
2332 find_package( NSIS )
2334 if (NOT "${MAKENSIS_EXECUTABLE}" STREQUAL "MAKENSIS_EXECUTABLE-NOTFOUND")
2335 add_subdirectory( packaging/nsis EXCLUDE_FROM_ALL )
2336 ADD_NSIS_UNINSTALLER_TARGET()
2337 ADD_NSIS_PACKAGE_TARGET()
2340 find_package( PortableApps )
2342 NOT "${PORTABLEAPPS_LAUNCHER_GENERATOR_EXECUTABLE}" STREQUAL "PORTABLEAPPS_LAUNCHER_GENERATOR_EXECUTABLE-NOTFOUND"
2344 NOT "${PORTABLEAPPS_INSTALLER_EXECUTABLE}" STREQUAL "PORTABLEAPPS_INSTALLER_EXECUTABLE-NOTFOUND"
2346 add_subdirectory( packaging/portableapps EXCLUDE_FROM_ALL )
2347 ADD_PORTABLEAPPS_PACKAGE_TARGET()
2351 if(BUILD_androiddump)
2352 if(EXTCAP_ANDROIDDUMP_LIBPCAP)
2354 set(androiddump_LIBS
2359 message(FATAL_ERROR "You try to build androiddump with libpcap but do not have it")
2362 set(androiddump_LIBS
2368 set(androiddump_FILES
2369 extcap/androiddump.c
2372 add_executable(androiddump WIN32 ${androiddump_FILES})
2373 # XXX Shouldn't we add wsutil to androiddump_LIBS instead?
2374 set_extcap_executable_properties(androiddump)
2375 target_link_libraries(androiddump ${androiddump_LIBS})
2376 install(TARGETS androiddump RUNTIME DESTINATION ${EXTCAP_DIR})
2379 if(BUILD_sshdump AND LIBSSH_FOUND)
2386 set(sshdump_LIBS wsutil ${sshdump_LIBS})
2392 add_executable(sshdump WIN32 ${sshdump_FILES})
2393 set_extcap_executable_properties(sshdump)
2394 target_link_libraries(sshdump ${sshdump_LIBS})
2395 target_include_directories(sshdump PUBLIC ${LIBSSH_INCLUDE_DIR})
2396 install(TARGETS sshdump RUNTIME DESTINATION ${EXTCAP_DIR})
2397 elseif (BUILD_sshdump)
2398 #message( WARNING "Cannot find libssh, cannot build sshdump" )
2401 if(BUILD_randpktdump)
2402 set(randpktdump_LIBS
2408 set(randpktdump_FILES
2409 extcap/randpktdump.c
2412 add_executable(randpktdump WIN32 ${randpktdump_FILES})
2413 # XXX Shouldn't we add wsutil to randpktdump_LIBS instead?
2414 set_extcap_executable_properties(randpktdump)
2415 target_link_libraries(randpktdump ${randpktdump_LIBS})
2416 install(TARGETS randpktdump RUNTIME DESTINATION ${EXTCAP_DIR})
2420 OUTPUT ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2421 COMMAND ${PERL_EXECUTABLE}
2422 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
2423 ${CMAKE_SOURCE_DIR}/doc/make-authors-short.pl
2424 < ${CMAKE_SOURCE_DIR}/AUTHORS
2425 > ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2427 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
2428 ${CMAKE_SOURCE_DIR}/doc/make-authors-short.pl
2429 ${CMAKE_SOURCE_DIR}/AUTHORS
2433 OUTPUT ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2434 COMMAND ${PERL_EXECUTABLE}
2435 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
2436 ${CMAKE_SOURCE_DIR}/doc/make-authors-format.pl
2437 < ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2438 > ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2440 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
2441 ${CMAKE_SOURCE_DIR}/doc/make-authors-format.pl
2442 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2446 FILE(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template WPT_WIN_PATH)
2447 FILE(TO_NATIVE_PATH ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT ASF_WIN_PATH)
2448 FILE(TO_NATIVE_PATH ${CMAKE_BINARY_DIR}/wireshark.pod WP_WIN_PATH)
2450 OUTPUT ${CMAKE_BINARY_DIR}/wireshark.pod
2451 COMMAND copy /B ${WPT_WIN_PATH} + ${ASF_WIN_PATH} ${WP_WIN_PATH}
2453 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
2454 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2459 OUTPUT ${CMAKE_BINARY_DIR}/wireshark.pod
2461 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
2462 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2463 > ${CMAKE_BINARY_DIR}/wireshark.pod
2465 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
2466 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2470 if(ENABLE_APPLICATION_BUNDLE)
2471 add_custom_target(app_bundle)
2472 set_target_properties(app_bundle PROPERTIES FOLDER "Copy Tasks")
2473 add_custom_command(TARGET app_bundle
2475 COMMAND "${CMAKE_SOURCE_DIR}/packaging/macosx/osx-app.sh"
2476 WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/run"
2478 add_dependencies(app_bundle ${PROGLIST})
2480 add_custom_target(dmg_package_prep DEPENDS app_bundle)
2483 OUTPUT ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo
2484 COMMAND ${CMAKE_COMMAND} -E echo APPLWshk > ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo
2487 ADD_CUSTOM_TARGET( dmg_package
2488 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2489 "${PROJECT_SOURCE_DIR}/ipmap.html"
2490 $<TARGET_FILE_DIR:wireshark>
2491 COMMAND ${CMAKE_COMMAND} -E copy_directory
2492 ${CMAKE_SOURCE_DIR}/packaging/macosx/ChmodBPF
2493 ${CMAKE_BINARY_DIR}/run/ChmodBPF
2494 COMMAND ${CMAKE_COMMAND} -E copy_directory
2495 ${CMAKE_SOURCE_DIR}/packaging/macosx/Resources
2496 ${CMAKE_BINARY_DIR}/run/Resources
2497 COMMAND ${CMAKE_COMMAND} -E copy_directory
2498 ${CMAKE_SOURCE_DIR}/packaging/macosx/Scripts
2499 ${CMAKE_BINARY_DIR}/run/Scripts
2500 COMMAND ${CMAKE_COMMAND} -E copy_directory
2501 ${CMAKE_SOURCE_DIR}/packaging/macosx/utility-launcher
2502 ${CMAKE_BINARY_DIR}/run/utility-launcher
2503 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2504 ${CMAKE_SOURCE_DIR}/COPYING
2505 ${CMAKE_BINARY_DIR}/run/COPYING.txt
2506 COMMAND ${CMAKE_COMMAND} -E copy_directory
2507 ${CMAKE_SOURCE_DIR}/packaging/macosx/Wireshark_package.pmdoc
2508 ${CMAKE_BINARY_DIR}/run/Wireshark_package.pmdoc
2509 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2510 ${CMAKE_BINARY_DIR}/packaging/macosx/Wireshark_package.pmdoc/index.xml
2511 ${CMAKE_BINARY_DIR}/run/Wireshark_package.pmdoc/index.xml
2512 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2513 ${CMAKE_SOURCE_DIR}/packaging/macosx/dmg_background.png
2514 ${CMAKE_BINARY_DIR}/run/dmg_background.png
2515 COMMAND bash -x ${CMAKE_BINARY_DIR}/packaging/macosx/osx-dmg.sh
2516 --source-directory ${CMAKE_SOURCE_DIR}/packaging/macosx
2517 # Unlike nsis_package_prep + nsis_package, we can add a direct
2519 DEPENDS dmg_package_prep
2520 # We create Wireshark.app in "run". Do our work there.
2521 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/run
2526 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/androiddump 1 )
2527 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/capinfos 1 )
2528 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/captype 1 )
2529 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dftest 1 )
2530 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dumpcap 1 )
2531 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/editcap 1 )
2532 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/extcap 4 )
2533 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/asn2deb 1 )
2534 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2deb 1 )
2535 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2wrs 1 )
2536 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/mergecap 1 )
2537 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/randpkt 1 )
2538 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/randpktdump 1 )
2539 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/rawshark 1 )
2540 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/reordercap 1 )
2541 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/sshdump 1 )
2542 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/text2pcap 1 )
2543 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/tshark 1 )
2544 pod2manhtml( ${CMAKE_BINARY_DIR}/wireshark 1 )
2545 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/wireshark-filter 4 )
2550 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2569 wireshark-filter.html
2571 set_target_properties(html_docs PROPERTIES FOLDER "Docs")
2579 ${randpktdump_FILES}
2580 ${text2pcap_CLEAN_FILES}
2586 ${androiddump_FILES}
2590 if (WERROR_COMMON_FLAGS)
2591 set_source_files_properties(
2594 COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
2602 ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
2609 ${CMAKE_INSTALL_MANDIR}/man1
2616 ${CMAKE_INSTALL_MANDIR}/man4
2621 "${CMAKE_BINARY_DIR}/wireshark.pc"
2623 ${CMAKE_INSTALL_LIBDIR}/pkgconfig
2629 DIRECTORY_PERMISSIONS
2630 OWNER_EXECUTE OWNER_WRITE OWNER_READ
2631 GROUP_EXECUTE GROUP_READ
2632 WORLD_EXECUTE WORLD_READ
2634 ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
2635 PATTERN ".git" EXCLUDE
2636 PATTERN ".svn" EXCLUDE
2637 PATTERN "Makefile.*" EXCLUDE
2638 PATTERN "faq.py" EXCLUDE
2641 include( UseCheckAPI )
2647 set(CMAKE_INSTALL_MODULES_DIR ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME})
2648 configure_file("${CMAKE_MODULE_PATH}/WiresharkConfig.cmake.in" "${CMAKE_BINARY_DIR}/WiresharkConfig.cmake" @ONLY)
2649 configure_file("${CMAKE_MODULE_PATH}/WiresharkConfigVersion.cmake.in" "${CMAKE_BINARY_DIR}/WiresharkConfigVersion.cmake" @ONLY)
2652 ${CMAKE_MODULE_PATH}/FindGLIB2.cmake
2653 ${CMAKE_MODULE_PATH}/FindWireshark.cmake
2654 ${CMAKE_MODULE_PATH}/FindWSWinLibs.cmake
2655 ${CMAKE_MODULE_PATH}/UseAsn2Wrs.cmake
2656 ${CMAKE_MODULE_PATH}/LocatePythonModule.cmake
2657 ${CMAKE_MODULE_PATH}/UseMakeDissectorReg.cmake
2658 ${CMAKE_BINARY_DIR}/WiresharkConfig.cmake
2659 ${CMAKE_BINARY_DIR}/WiresharkConfigVersion.cmake
2661 ${CMAKE_INSTALL_MODULES_DIR}
2665 message(STATUS "Docdir install: ${DOC_DIR}")
2668 ${CMAKE_BINARY_DIR}/docbook/
2669 DIRECTORY_PERMISSIONS
2670 OWNER_EXECUTE OWNER_WRITE OWNER_READ
2671 GROUP_EXECUTE GROUP_READ
2672 WORLD_EXECUTE WORLD_READ
2680 # Test suite wrapper
2681 if(ENABLE_APPLICATION_BUNDLE)
2682 set(TEST_SH_BIN_DIR ${CMAKE_BINARY_DIR}/run)
2684 set(TEST_SH_BIN_DIR $<TARGET_FILE_DIR:epan>)
2687 add_custom_target(test-sh
2688 COMMAND ${CMAKE_COMMAND}
2689 -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
2690 -DTEST_SH_BIN_DIR=${TEST_SH_BIN_DIR}
2691 -DTEST_SH_SRC_DIR=${CMAKE_SOURCE_DIR}/test
2692 -P ${CMAKE_SOURCE_DIR}/cmake/modules/GenerateTestSh.cmake
2693 DEPENDS ${CMAKE_SOURCE_DIR}/cmake/modules/GenerateTestSh.cmake
2695 set_target_properties(test-sh PROPERTIES FOLDER "Tests")
2697 add_custom_target(test-programs
2704 COMMENT "Building unit test programs and wrapper"
2706 set_target_properties(test-programs PROPERTIES FOLDER "Tests")
2709 file (TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/tools/Get-HardenFlags.ps1 _win_harden_flags)
2710 add_custom_target(hardening-check
2711 COMMAND ${POWERSHELL_COMMAND} "${_win_harden_flags}" "${_dll_output_dir_win}"
2713 COMMENT "Checking binaries for security features"
2715 set_target_properties(hardening-check PROPERTIES FOLDER "Tests")
2717 find_program(HARDENING_CHECK_EXECUTABLE hardening-check
2718 DOC "Path to the hardening-check utility."
2720 if (NOT "${HARDENING_CHECK_EXECUTABLE}" STREQUAL "HARDENING_CHECK_EXECUTABLE-NOTFOUND")
2721 foreach(_prog ${PROGLIST})
2722 get_target_property(_prog_dir ${_prog} RUNTIME_OUTPUT_DIRECTORY)
2723 if ("${_prog_dir}" STREQUAL "_prog_dir-NOTFOUND")
2724 set(_prog_dir "${CMAKE_BINARY_DIR}/run")
2726 set(_prog_paths ${_prog_paths} "${_prog_dir}/${_prog}")
2728 add_custom_target(hardening-check
2729 COMMAND ${HARDENING_CHECK_EXECUTABLE} ${_prog_paths}
2731 COMMENT "Checking binaries for security features"
2737 # Editor modelines - http://www.wireshark.org/tools/modelines.html
2742 # indent-tabs-mode: t
2745 # vi: set shiftwidth=8 tabstop=8 noexpandtab:
2746 # :indentSize=8:tabSize=8:noTabs=false: