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))" )
598 set(WIRESHARK_LD_FLAGS
604 # CMAKE_POSITION_INDEPENDENT_CODE is only supported starting with CMake
605 # 2.8.9. Do not add -pie automatically for older versions.
607 # XXX - are there other compilers that don't support -pie? It's
608 # not as if the only platforms we support are Windows and Linux....
610 if(NOT CMAKE_VERSION VERSION_LESS "2.8.9")
611 set(WIRESHARK_LD_FLAGS ${WIRESHARK_LD_FLAGS}
616 include(CheckCLinkerFlag)
618 # Sigh: Have to use THIS_FLAG instead of ${F} for some reason
619 foreach(THIS_FLAG ${WIRESHARK_LD_FLAGS})
620 set(F WS_LD_FLAG_${_C})
621 set(${F} ${THIS_FLAG})
622 set(V WS_LD_FLAG_VALID${_C})
623 check_c_linker_flag(${${F}} ${V})
625 set(WS_LINK_FLAGS "${WS_LINK_FLAGS} ${${F}}")
627 math(EXPR _C "${_C} + 1")
630 if(APPLE AND EXISTS /usr/local/opt/gettext)
631 # GLib on OS X requires libintl. Homebrew installs gettext (and
632 # libintl) in /usr/local/opt/gettext
633 include_directories(/usr/local/opt/gettext/include)
634 link_directories(/usr/local/opt/gettext/lib)
637 # The packagelist is doing some magic: If we add XXX to the packagelist, we
638 # - may optionally set XXX_OPTIONS to pass to the find_package command
639 # - will call FindXXX.cmake
640 # - return found libraries in XXX_LIBRARIES
641 # - return found include in XXX_INCLUDE_DIRS
644 #The minimum package list
645 set(PACKAGELIST Gettext M Git GLIB2 GMODULE2 GTHREAD2 LEX YACC Perl SED SH PythonInterp)
646 set(LEX_REQUIRED TRUE)
647 set(GLIB2_REQUIRED TRUE)
648 set(GLIB2_FIND_REQUIRED TRUE)
649 set(GLIB2_MIN_VERSION 2.14.0)
650 set(GTHREAD2_REQUIRED TRUE)
651 set(PythonInterp_FIND_VERSION 2)
652 set(Python_ADDITIONAL_VERSIONS 3)
653 set(YACC_REQUIRED TRUE)
659 set(PACKAGELIST ${PACKAGELIST} HtmlViewer)
661 set(PACKAGELIST ${PACKAGELIST} LIBSSH)
662 set(LIBSSH_OPTIONS "0.6")
665 set(PACKAGELIST ${PACKAGELIST} PCAP)
669 set(PACKAGELIST ${PACKAGELIST} AIRPCAP)
673 if(BUILD_wireshark_gtk)
675 set(PACKAGELIST ${PACKAGELIST} GTK3)
677 set(PACKAGELIST ${PACKAGELIST} GTK2)
678 set(GTK2_OPTIONS COMPONENTS gtk)
679 set(GTK2_FIND_VERSION 2.12)
680 set(GTK2_DEBUG false)
687 # Untested, may not work if CMAKE_PREFIX_PATH gets overwritten
688 # somewhere. The if WIN32 in this place is annoying as well.
690 set( QT5_BASE_PATH "$ENV{QT5_BASE_DIR}" )
691 set( CMAKE_PREFIX_PATH "${QT5_BASE_PATH}" )
693 set(PACKAGELIST ${PACKAGELIST}
702 set(PACKAGELIST ${PACKAGELIST} Qt5MacExtras)
705 set(PACKAGELIST ${PACKAGELIST} Qt5WinExtras)
709 set(PACKAGELIST ${PACKAGELIST} Qt4)
710 set(Qt4_OPTIONS 4.7.1 REQUIRED QtCore QtGui)
717 set(PACKAGELIST ${PACKAGELIST} SMI)
722 set(PACKAGELIST ${PACKAGELIST} GCRYPT)
723 # Minimum version needed.
724 set(GCRYPT_OPTIONS "1.4.2")
727 # GNU SSL/TLS support
729 set(PACKAGELIST ${PACKAGELIST} GNUTLS)
730 # Minimum version needed.
731 set(GNUTLS_OPTIONS "2.12.0")
736 set(PACKAGELIST ${PACKAGELIST} KERBEROS)
739 # Portable audio (GTK+ only)
740 if(ENABLE_PORTAUDIO AND BUILD_wireshark_gtk)
741 set(PACKAGELIST ${PACKAGELIST} PORTAUDIO)
745 # Prefer c-ares over adns
746 if(ENABLE_CARES) # C Asynchronouse resolver
747 set(PACKAGELIST ${PACKAGELIST} CARES)
748 elseif(ENABLE_ADNS) # Gnu asynchronous DNS
749 set(PACKAGELIST ${PACKAGELIST} ADNS)
755 # On Windows we build our own version of zlib, so add the paths
756 set(ZLIB_SRC_DIR "${_PROJECT_LIB_DIR}/zlib-1.2.8-ws")
757 set(SKIP_INSTALL_ALL True) # We copy the DLL ourselves.
758 add_subdirectory("${ZLIB_SRC_DIR}" "${CMAKE_BINARY_DIR}/zlib")
759 unset(SKIP_INSTALL_ALL)
760 set(ZLIB_INCLUDE_DIR "${ZLIB_SRC_DIR}" "${CMAKE_BINARY_DIR}/zlib")
761 set(ZLIB_LIBRARY zlib)
762 set(ZLIB_DLL "zlib1.dll")
763 set_target_properties(zlib PROPERTIES FOLDER "Libs/zlib")
764 # Annoyingly zlib also builds some other stuff we aren't interested in
765 set_target_properties(zlibstatic PROPERTIES FOLDER "Libs/zlib")
767 set(PACKAGELIST ${PACKAGELIST} ZLIB)
770 # Embedded Lua interpreter
772 set(PACKAGELIST ${PACKAGELIST} LUA)
775 # GeoIP address resolving
777 set(PACKAGELIST ${PACKAGELIST} GEOIP)
781 set(PACKAGELIST ${PACKAGELIST} NL)
785 set(PACKAGELIST ${PACKAGELIST} SBC)
790 set(PACKAGELIST ${PACKAGELIST} CAP SETCAP)
793 # Windows version updates
794 if(ENABLE_WINSPARKLE)
795 set(PACKAGELIST ${PACKAGELIST} WINSPARKLE)
798 set(PACKAGELIST ${PACKAGELIST} YAPP)
800 set(PACKAGELIST ${PACKAGELIST} POD)
802 if(ENABLE_HTML_GUIDES)
803 set(PACKAGELIST ${PACKAGELIST} DOXYGEN)
808 # Sort the package list
809 list(SORT PACKAGELIST)
810 message(STATUS "Packagelist: ${PACKAGELIST}")
811 # Let's loop the package list
812 foreach(PACKAGE ${PACKAGELIST})
813 if(${PACKAGE} STREQUAL "Qt4")
814 set(PACKAGE_VAR "QT")
815 elseif(${PACKAGE} STREQUAL "PythonInterp")
816 set(PACKAGE_VAR "PYTHONINTERP")
817 elseif(${PACKAGE} STREQUAL "Gettext")
818 set(PACKAGE_VAR "GETTEXT")
819 elseif(${PACKAGE} STREQUAL "HtmlViewer")
820 set(PACKAGE_VAR "HTML_VIEWER")
821 elseif(${PACKAGE} STREQUAL "Perl")
822 set(PACKAGE_VAR "PERL")
824 set(PACKAGE_VAR ${PACKAGE})
826 if(${PACKAGE}_OPTIONS)
827 find_package(${PACKAGE} ${${PACKAGE}_OPTIONS})
828 elseif(${PACKAGE}_REQUIRED)
829 find_package(${PACKAGE} REQUIRED)
831 find_package(${PACKAGE})
833 if (${PACKAGE_VAR}_FOUND)
834 message(STATUS "${PACKAGE_VAR} FOUND")
835 set(HAVE_LIB${PACKAGE_VAR} 1)
836 include_directories(SYSTEM ${${PACKAGE_VAR}_INCLUDE_DIRS})
837 set(WS_ALL_LIBS ${WS_ALL_LIBS} ${${PACKAGE_VAR}_LIBRARIES})
838 message(STATUS "${PACKAGE} includes: ${${PACKAGE_VAR}_INCLUDE_DIRS}")
839 message(STATUS "${PACKAGE} libs: ${${PACKAGE_VAR}_LIBRARIES}")
840 if (${PACKAGE}_DEFINITIONS)
841 message(STATUS "${PACKAGE} definitions: ${${PACKAGE_VAR}_DEFINITIONS}")
843 if (${PACKAGE_VAR}_EXECUTABLE)
844 message(STATUS "${PACKAGE} executable: ${${PACKAGE_VAR}_EXECUTABLE}")
848 # Not finding a package is only a fatal error if the
849 # package is required; if it's required, then its
850 # XXX_REQUIRED variable is set to TRUE, and the above
851 # code will pass REQUIRED to find_package, and the
852 # configure will fail if the package isn't found.
854 # Do *NOT* report this as an error!
856 message(STATUS "${PACKAGE_VAR} NOT FOUND")
860 # Provide Windows system lib names
861 include( UseWinLibs )
864 include(CPackConfig.txt)
888 if(NOT HAVE_LIBCARES AND NOT HAVE_LIBADNS)
889 # We should make this an error at some point.
890 message(WARNING "Not using c-ares or ADNS.")
891 message(WARNING "Synchronous name resolution can seriously degrade performance.")
893 if(HAVE_LIBNL AND HAVE_AIRPCAP)
894 message(ERROR "Airpcap and Libnl support are mutually exclusive")
899 if(EXTCAP_ANDROIDDUMP_LIBPCAP)
900 set(ANDROIDDUMP_USE_LIBPCAP 1)
903 if (HAVE_LIBWINSPARKLE)
904 set(HAVE_SOFTWARE_UPDATE 1)
907 # No matter which version of GTK is present
908 if(GTK2_FOUND OR GTK3_FOUND)
911 # That's the name autofoo uses
914 # Always include the "true" zlib includes first. This works around a
915 # bug in the Windows setup of GTK[23] which has a faulty zconf.h.
916 include_directories(BEFORE ${ZLIB_INCLUDE_DIRS})
918 if (Qt5Widgets_FOUND)
920 # Qt5CoreConfigExtras.cmake in Qt 5.5.0 sets -fPIC unconditionally:
922 # https://bugreports.qt.io/browse/QTBUG-47942
924 # There's a fix in Gerrit for that:
926 # https://codereview.qt-project.org/#/c/139645/
928 # Do the same check as that fix does and, if the check says we
929 # should *not* add -fPIC, remove it.
931 # XXX - if that check gets changed in the future, we'll have to
932 # detect that and change it.
934 if (CMAKE_VERSION VERSION_LESS 2.8.12
935 AND (CMAKE_CXX_COMPILER_ID STREQUAL \"GNU\"
936 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))
938 # Yes, it should have been; leave it there.
942 # No, it shouldn't have been; remove it.
944 list(REMOVE_ITEM Qt5Widgets_EXECUTABLE_COMPILE_FLAGS "-fPIC")
946 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
948 set (QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES})
949 if(Qt5Multimedia_FOUND)
950 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5Multimedia_LIBRARIES})
951 # That's the name autofoo uses
952 set(QT_MULTIMEDIA_LIB 1)
955 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5Svg_LIBRARIES})
956 # That's the name autofoo uses
959 if(Qt5MacExtras_FOUND)
960 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5MacExtras_LIBRARIES})
961 # That's the name autofoo uses
962 set(QT_MACEXTRAS_LIB 1)
964 if(Qt5WinExtras_FOUND)
965 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5WinExtras_LIBRARIES})
966 # set(QT_WINEXTRAS_LIB 1) # Not needed?
968 if(NOT DEFINED MOC_OPTIONS)
969 set(MOC_OPTIONS --no-notes)
971 # If Qt4: QT_LIBRARIES and QT_INCLUDES are not set above. They require extra magic
973 include(${QT_USE_FILE})
974 include_directories(${QT_INCLUDE_DIR})
975 message(STATUS "Qt includes: ${QT_INCLUDE_DIR}")
976 message(STATUS "Qt libs: ${QT_LIBRARIES}")
977 if(QT_QTMULTIMEDIA_FOUND)
978 include_directories(${QT_QTMULTIMEDIA_INCLUDE_DIR})
979 message(STATUS "QtMultimedia includes: ${QT_INCLUDE_DIR}")
980 set (QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMULTIMEDIA_LIBRARY})
981 message(STATUS "QtMultimedia libs: ${QT_QTMULTIMEDIA_LIBRARY}")
982 # That's the name autofoo uses
983 set(QT_MULTIMEDIA_LIB 1)
985 if(NOT DEFINED MOC_OPTIONS)
986 if(QT_VERSION_MAJOR EQUAL 4 AND QT_VERSION_MINOR GREATER 7)
992 message(STATUS "C-Flags: ${CMAKE_C_FLAGS}")
993 message(STATUS "CXX-Flags: ${CMAKE_CXX_FLAGS}")
994 message(STATUS "Warnings as errors: ${WERROR_COMMON_FLAGS}")
998 # We assume that APPLE means OS X so that we have the OS X
1001 set(HAVE_OS_X_FRAMEWORKS 1)
1002 FIND_LIBRARY (APPLE_APPLICATION_SERVICES_LIBRARY ApplicationServices)
1003 FIND_LIBRARY (APPLE_CORE_FOUNDATION_LIBRARY CoreFoundation)
1004 FIND_LIBRARY (APPLE_SYSTEM_CONFIGURATION_LIBRARY SystemConfiguration)
1007 include(ConfigureChecks.cmake)
1009 #Big or little endian ?
1010 include(TestBigEndian)
1011 test_big_endian(WORDS_BIGENDIAN)
1013 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
1015 add_subdirectory( asn1 EXCLUDE_FROM_ALL )
1016 add_subdirectory( capchild )
1017 add_subdirectory( caputils )
1018 add_subdirectory( codecs )
1019 add_subdirectory( docbook )
1020 add_subdirectory( epan )
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
1209 ui/gtk/doxygen.cfg.in
1210 ui/qt/doxygen.cfg.in
1213 foreach( _in_file ${IN_FILES} )
1214 get_filename_component( _path ${_in_file} PATH )
1215 string( REGEX REPLACE "(.*)\\.in" "\\1" _outfile ${_in_file} )
1216 configure_file( ${CMAKE_SOURCE_DIR}/${_in_file} ${CMAKE_BINARY_DIR}/${_outfile} @ONLY )
1219 include(FeatureSummary)
1220 #SET_FEATURE_INFO(NAME DESCRIPTION [URL [COMMENT] ])
1221 SET_FEATURE_INFO(SBC "SBC Codec for Bluetooth A2DP stream playing" "www: http://git.kernel.org/cgit/bluetooth/sbc.git" )
1222 SET_FEATURE_INFO(LIBSSH "libssh is library for ssh connections and it is needed to build sshdump" "www: https://www.libssh.org/get-it/" )
1224 FEATURE_SUMMARY(WHAT ALL)
1227 ${CMAKE_BINARY_DIR}/ui
1228 ${CMAKE_BINARY_DIR}/ui/gtk
1229 ${CMAKE_BINARY_DIR}/ui/qt
1230 ${CMAKE_BINARY_DIR}/capchild
1231 ${CMAKE_BINARY_DIR}/caputils
1232 ${CMAKE_BINARY_DIR}/codecs
1233 ${CMAKE_BINARY_DIR}/epan
1234 ${CMAKE_BINARY_DIR}/wiretap
1235 ${CMAKE_BINARY_DIR}/wsutil
1240 ui/win32/console_win32.c
1241 ui/win32/file_dlg_win32.c
1242 ui/win32/print_win32.c
1244 set(PLATFORM_UI_RC_FILES
1245 image/file_dlg_win32.rc
1249 # sources common for wireshark, tshark, and rawshark
1250 set(SHARK_COMMON_SRC
1256 # sources for external capture interfaces
1258 set(SHARK_COMMON_SRC
1266 ui/cli/tap-camelsrt.c
1267 ui/cli/tap-comparestat.c
1268 ui/cli/tap-diameter-avp.c
1270 ui/cli/tap-endpoints.c
1273 ui/cli/tap-gsm_astat.c
1275 ui/cli/tap-httpstat.c
1276 ui/cli/tap-icmpstat.c
1277 ui/cli/tap-icmpv6stat.c
1279 ui/cli/tap-iousers.c
1280 ui/cli/tap-macltestat.c
1281 ui/cli/tap-protocolinfo.c
1282 ui/cli/tap-protohierstat.c
1283 ui/cli/tap-rlcltestat.c
1284 ui/cli/tap-rpcprogs.c
1287 ui/cli/tap-rtspstat.c
1288 ui/cli/tap-sctpchunkstat.c
1289 ui/cli/tap-simple_stattable.c
1290 ui/cli/tap-sipstat.c
1291 ui/cli/tap-smbsids.c
1293 ui/cli/tap-stats_tree.c
1295 ui/cli/tap-wspstat.c
1308 ${CMAKE_BINARY_DIR}/androiddump.html
1309 ${CMAKE_BINARY_DIR}/sshdump.html
1310 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
1311 ${CMAKE_BINARY_DIR}/capinfos.html
1312 ${CMAKE_BINARY_DIR}/captype.html
1316 ${CMAKE_BINARY_DIR}/dftest.html
1317 ${CMAKE_BINARY_DIR}/dumpcap.html
1318 ${CMAKE_BINARY_DIR}/editcap.html
1319 ${CMAKE_BINARY_DIR}/extcap.html
1320 ${CMAKE_BINARY_DIR}/asn2deb.html
1321 ${CMAKE_BINARY_DIR}/idl2deb.html
1322 ${CMAKE_BINARY_DIR}/idl2wrs.html
1325 ${CMAKE_BINARY_DIR}/mergecap.html
1327 ${CMAKE_BINARY_DIR}/randpkt.html
1328 ${CMAKE_BINARY_DIR}/randpktdump.html
1329 ${CMAKE_BINARY_DIR}/rawshark.html
1330 ${CMAKE_BINARY_DIR}/reordercap.html
1333 ${CMAKE_BINARY_DIR}/text2pcap.html
1334 ${CMAKE_BINARY_DIR}/tshark.html
1335 ${CMAKE_BINARY_DIR}/wireshark-filter.html
1336 ${CMAKE_BINARY_DIR}/wireshark.html
1341 set(TEXTIFY_FILES COPYING NEWS README README.windows)
1342 foreach(_text_file ${TEXTIFY_FILES})
1343 set(INSTALL_FILES ${CMAKE_BINARY_DIR}/${_text_file}.txt ${INSTALL_FILES})
1346 set(INSTALL_FILES COPYING ${INSTALL_FILES})
1350 ${CMAKE_BINARY_DIR}/androiddump.1
1351 ${CMAKE_BINARY_DIR}/capinfos.1
1352 ${CMAKE_BINARY_DIR}/captype.1
1353 ${CMAKE_BINARY_DIR}/dftest.1
1354 ${CMAKE_BINARY_DIR}/dumpcap.1
1355 ${CMAKE_BINARY_DIR}/editcap.1
1356 ${CMAKE_BINARY_DIR}/extcap.4
1357 ${CMAKE_BINARY_DIR}/idl2wrs.1
1358 ${CMAKE_BINARY_DIR}/mergecap.1
1359 ${CMAKE_BINARY_DIR}/randpkt.1
1360 ${CMAKE_BINARY_DIR}/androiddump.1
1361 ${CMAKE_BINARY_DIR}/rawshark.1
1362 ${CMAKE_BINARY_DIR}/reordercap.1
1363 ${CMAKE_BINARY_DIR}/sshdump.1
1364 ${CMAKE_BINARY_DIR}/text2pcap.1
1365 ${CMAKE_BINARY_DIR}/tshark.1
1366 ${CMAKE_BINARY_DIR}/wireshark.1
1370 ${CMAKE_BINARY_DIR}/wireshark-filter.4
1374 # @NSL_LIBS@ # -lnsl
1375 # @SOCKET_LIBS@ # -lsocket
1376 # @SSL_LIBS@ # -lcrypto
1378 # $(plugin_ldadd) # in case of static
1379 ${AIRPCAP_LIBRARIES}
1383 ${KERBEROS_LIBRARIES}
1392 ${WINSPARKLE_LIBRARIES}
1396 # According to http://stackoverflow.com/questions/14474659/cmake-how-to-have-a-target-for-copying-files
1397 # we can't just use "set(_dll_output_dir "$<TARGET_FILE_DIR:epan>")"
1398 # DATAFILE_DIR is set using the same property. We could probably
1399 # get away with using it here.
1400 get_target_property(_libwireshark_location epan LOCATION)
1401 get_filename_component(_dll_output_dir "${_libwireshark_location}" PATH)
1402 add_custom_target(copy_cli_dlls)
1403 set_target_properties(copy_cli_dlls PROPERTIES FOLDER "Copy Tasks")
1404 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1405 COMMAND ${CMAKE_COMMAND} -E make_directory "${_dll_output_dir}"
1408 # XXX Can (and should) we iterate over these similar to the way
1409 # the top-level CMakeLists.txt iterates over the package list?
1412 # The cairo, freetype, gio, gnutls, png, and other OBS-generated DLLs
1413 # depend on zlib1.dll. We compile zlib locally but the Debug
1414 # configuration (the default) creates zlibd1.dll.
1415 file (TO_NATIVE_PATH "${_dll_output_dir}" _dll_output_dir_win )
1416 foreach( _dll ${GLIB2_DLLS} $<$<CONFIG:Debug>:zlib1.dll> )
1417 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1418 # It would be really handy if copy, xcopy, or "cmake
1419 # -E copy_if_different" supported multiple files
1420 # separated by whitespace, or if robocpy had a sane
1421 # notion of exit codes.
1422 COMMAND if exist \"${_dll}\" xcopy ${_dll} "${_dll_output_dir_win}" /D /Y
1423 WORKING_DIRECTORY "${GLIB2_DLL_DIR}"
1428 # Don't overwrite an exe if it's already there. We don't want to
1429 # clobber any previous code signing.
1430 file(GLOB _gspawn_helpers
1431 RELATIVE "${GLIB2_DLL_DIR}"
1432 "${GLIB2_DLL_DIR}/gspawn*.exe"
1434 foreach(_gspawn_helper ${_gspawn_helpers})
1435 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1436 COMMAND if not exist \"${_dll_output_dir_win}\\${_gspawn_helper}\" xcopy ${_gspawn_helper} "${_dll_output_dir_win}" /D /Y
1437 WORKING_DIRECTORY "${GLIB2_DLL_DIR}"
1443 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1444 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1445 "${AIRPCAP_DLL_DIR}/${AIRPCAP_DLL}"
1446 "${_dll_output_dir}"
1448 endif(AIRPCAP_FOUND)
1450 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1451 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1452 "${CARES_DLL_DIR}/${CARES_DLL}"
1453 "${_dll_output_dir}"
1457 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1458 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1459 "${GEOIP_DLL_DIR}/${GEOIP_DLL}"
1460 "${_dll_output_dir}"
1464 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1465 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1466 "${LIBSSH_DLL_DIR}/${LIBSSH_DLL}"
1467 "${_dll_output_dir}"
1471 foreach( _dll ${GCRYPT_DLLS} )
1472 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1473 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1474 "${GCRYPT_DLL_DIR}/${_dll}"
1475 "${_dll_output_dir}"
1480 foreach( _dll ${GNUTLS_DLLS} )
1481 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1482 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1483 "${GNUTLS_DLL_DIR}/${_dll}"
1484 "${_dll_output_dir}"
1489 foreach( _dll ${KERBEROS_DLLS} )
1490 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1491 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1492 "${KERBEROS_DLL_DIR}/${_dll}"
1493 "${_dll_output_dir}"
1496 endif(KERBEROS_FOUND)
1498 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1499 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1500 "${LUA_DLL_DIR}/${LUA_DLL}"
1501 "${_dll_output_dir}"
1505 # Wireshark.nsi wants SMI_DIR which is the base SMI directory
1506 get_filename_component(SMI_DIR ${SMI_DLL_DIR} DIRECTORY)
1507 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1508 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1509 "${SMI_DLL_DIR}/${SMI_DLL}"
1510 "${_dll_output_dir}"
1511 COMMAND ${CMAKE_COMMAND} -E make_directory
1512 "${_dll_output_dir}/snmp"
1513 COMMAND ${CMAKE_COMMAND} -E make_directory
1514 "${_dll_output_dir}/snmp/mibs"
1515 COMMAND ${CMAKE_COMMAND} -E copy_directory
1516 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/iana"
1517 "${_dll_output_dir}/snmp/mibs"
1518 COMMAND ${CMAKE_COMMAND} -E copy_directory
1519 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/ietf"
1520 "${_dll_output_dir}/snmp/mibs"
1521 COMMAND ${CMAKE_COMMAND} -E copy_directory
1522 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/irtf"
1523 "${_dll_output_dir}/snmp/mibs"
1524 COMMAND ${CMAKE_COMMAND} -E copy_directory
1525 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/site"
1526 "${_dll_output_dir}/snmp/mibs"
1527 COMMAND ${CMAKE_COMMAND} -E copy_directory
1528 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/tubs"
1529 "${_dll_output_dir}/snmp/mibs"
1530 COMMAND ${CMAKE_COMMAND} -E copy_directory
1531 "${SMI_SHARE_DIR}/${SMI_DLL}/pibs"
1532 "${_dll_output_dir}/snmp/mibs"
1533 COMMAND ${CMAKE_COMMAND} -E copy_directory
1534 "${SMI_SHARE_DIR}/${SMI_DLL}/yang"
1535 "${_dll_output_dir}/snmp/mibs"
1538 if (WINSPARKLE_FOUND)
1539 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1540 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1541 "${WINSPARKLE_DLL_DIR}/${WINSPARKLE_DLL}"
1542 "${_dll_output_dir}"
1544 endif(WINSPARKLE_FOUND)
1546 add_dependencies(epan copy_cli_dlls)
1548 # We have a lot of choices for creating zip archives:
1549 # - 7z, WinZip, etc., which require a separate download+install.
1550 # - Cygwin's zip, which requires Cygwin.
1551 # - "CMake -E tar cz", which creates a tar file.
1552 # - CPack, which requires a CPack configuration.
1553 # - PowerShell via PSCX or System.IO.Compression.FileSystem.
1554 # - Python via zipfile.
1555 # For now, just look for 7z. It's installed on the Windows builders,
1556 # which might be the only systems that use this target.
1557 find_program(ZIP_EXECUTABLE 7z
1558 PATH "$ENV{PROGRAMFILES}/7-Zip" "$ENV{PROGRAMW6432}/7-Zip"
1559 DOC "Path to the 7z utility."
1561 # XXX "if(ZIP_EXECUTABLE)" doesn't work here. It looks like the
1562 # absence of "-NOTFOUND" doesn't equal "true".
1563 if (NOT "${ZIP_EXECUTABLE}" STREQUAL "ZIP_EXECUTABLE-NOTFOUND")
1564 add_custom_target(pdb_zip_package)
1565 set_target_properties(pdb_zip_package PROPERTIES FOLDER "Packaging")
1566 set(_pdb_zip "${CMAKE_BINARY_DIR}/Wireshark-pdb-${WIRESHARK_TARGET_PLATFORM}-${VERSION}.zip")
1567 file(TO_NATIVE_PATH "${_pdb_zip}" _pdb_zip_win)
1568 add_custom_command(TARGET pdb_zip_package POST_BUILD
1569 COMMAND ${CMAKE_COMMAND} -E remove -f "${_pdb_zip}"
1570 COMMAND ${ZIP_EXECUTABLE} a -tzip -mmt=on "${_pdb_zip_win}" *.pdb *.lib
1571 WORKING_DIRECTORY "${_dll_output_dir}"
1573 add_dependencies(pdb_zip_package epan)
1577 # List of extra dependencies for the "copy_data_files" target
1578 set(copy_data_files_depends)
1580 # glob patterns relative to the source directory that should be copied to
1581 # ${DATAFILE_DIR} (including directory prefixes)
1587 foreach(_text_file ${TEXTIFY_FILES})
1588 add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${_text_file}.txt
1589 COMMAND ${POWERSHELL_COMMAND} "${CMAKE_SOURCE_DIR}/tools/textify.ps1"
1590 -Destination ${CMAKE_BINARY_DIR}
1591 ${CMAKE_SOURCE_DIR}/${_text_file}
1593 ${CMAKE_SOURCE_DIR}/${_text_file}
1598 foreach(_install_file ${INSTALL_FILES})
1599 get_filename_component(_install_basename "${_install_file}" NAME)
1600 set(_output_file "${DATAFILE_DIR}/${_install_basename}")
1601 add_custom_command(OUTPUT "${_output_file}"
1602 COMMAND ${CMAKE_COMMAND} -E copy
1605 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
1610 list(APPEND copy_data_files_depends "${_output_file}")
1614 # Ensure "run/extcap" exists
1615 add_custom_command(OUTPUT "${DATAFILE_DIR}/extcap"
1616 COMMAND ${CMAKE_COMMAND} -E make_directory
1617 "${DATAFILE_DIR}/extcap"
1619 list(APPEND copy_data_files_depends "${DATAFILE_DIR}/extcap")
1622 help/capture_filters.txt
1624 help/display_filters.txt
1625 help/getting_started.txt
1629 file(TO_NATIVE_PATH "${DATAFILE_DIR}/help" _help_dest_dir)
1630 foreach(_help_file IN LISTS _help_files)
1631 add_custom_command(OUTPUT "${DATAFILE_DIR}/${_help_file}"
1632 COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/help"
1633 COMMAND ${POWERSHELL_COMMAND} "${CMAKE_SOURCE_DIR}/tools/textify.ps1"
1634 -Destination "${_help_dest_dir}"
1635 "${CMAKE_SOURCE_DIR}/${_help_file}"
1637 "${CMAKE_SOURCE_DIR}/${_help_file}"
1639 list(APPEND copy_data_files_depends "${DATAFILE_DIR}/${_help_file}")
1642 list(APPEND DATA_FILES_SRC ${_help_files})
1645 # Create help/faq.txt when missing
1646 add_custom_command(OUTPUT "${DATAFILE_DIR}/help/faq.txt"
1647 COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/help"
1648 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/help/faq.py -b > faq.tmp.html
1649 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/html2text.py
1650 faq.tmp.html > "${DATAFILE_DIR}/help/faq.txt"
1651 COMMAND ${CMAKE_COMMAND} -E remove faq.tmp.html
1653 "${CMAKE_SOURCE_DIR}/help/faq.py"
1654 "${CMAKE_SOURCE_DIR}/tools/html2text.py"
1656 list(APPEND copy_data_files_depends "${DATAFILE_DIR}/help/faq.txt")
1658 # Install LUA files in staging directory such that LUA can used when Wireshark
1659 # is ran from the build directory. For install targets, see
1660 # epan/wslua/CMakeLists.txt
1661 if(LUA_FOUND AND ENABLE_LUA)
1663 "${CMAKE_BINARY_DIR}/epan/wslua/init.lua"
1664 "${CMAKE_SOURCE_DIR}/epan/wslua/console.lua"
1665 "${CMAKE_SOURCE_DIR}/epan/wslua/dtd_gen.lua"
1667 foreach(_lua_file ${_lua_files})
1668 get_filename_component(_lua_filename "${_lua_file}" NAME)
1669 list(APPEND copy_data_files_depends
1670 "${DATAFILE_DIR}/${_lua_filename}")
1671 add_custom_command(OUTPUT "${DATAFILE_DIR}/${_lua_filename}"
1672 COMMAND ${CMAKE_COMMAND} -E copy
1674 "${DATAFILE_DIR}/${_lua_filename}"
1680 endif(LUA_FOUND AND ENABLE_LUA)
1681 # doc/*.html handled elsewhere.
1683 # TODO shouldn't this use full (relative) paths instead of glob patterns?
1684 list(APPEND DATA_FILES_SRC
1687 "radius/README.radius_dictionary"
1688 "radius/custom.includes"
1690 "radius/dictionary.*"
1700 # Copy all paths from the source tree to the data directory. Directories are
1701 # automatically created if missing as the filename is given.
1702 file(GLOB _data_files RELATIVE "${CMAKE_SOURCE_DIR}" ${DATA_FILES_SRC})
1703 foreach(_data_file ${_data_files})
1704 add_custom_command(OUTPUT "${DATAFILE_DIR}/${_data_file}"
1705 COMMAND ${CMAKE_COMMAND} -E copy
1706 "${CMAKE_SOURCE_DIR}/${_data_file}"
1707 "${DATAFILE_DIR}/${_data_file}"
1709 "${CMAKE_SOURCE_DIR}/${_data_file}"
1711 list(APPEND copy_data_files_depends "${DATAFILE_DIR}/${_data_file}")
1714 # Copy files including ${INSTALL_FILES} and ${INSTALL_DIRS} to ${DATAFILE_DIR}
1715 add_custom_target(copy_data_files ALL DEPENDS ${copy_data_files_depends})
1716 set_target_properties(copy_data_files PROPERTIES FOLDER "Copy Tasks")
1718 if( (BUILD_wireshark AND QT_FOUND) OR (BUILD_wireshark_gtk AND GTK_FOUND) )
1731 ${CMAKE_BINARY_DIR}/image/wireshark.rc
1732 ${PLATFORM_UI_RC_FILES}
1736 if(ENABLE_APPLICATION_BUNDLE)
1738 # Add -Wl,-single_module to the LDFLAGS used with shared
1739 # libraries, to fix some error that show up in some cases;
1740 # some Apple documentation recommends it for most shared
1743 set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-single_module ${CMAKE_SHARED_LINKER_FLAGS}" )
1745 # Add -Wl,-headerpad_max_install_names to the LDFLAGS, as
1746 # code-signing issues is running out of padding space.
1748 # Add -Wl,-search_paths_first to make sure that if we search
1749 # directories A and B, in that order, for a given library, a
1750 # non-shared version in directory A, rather than a shared
1751 # version in directory B, is chosen (so we can use
1752 # --with-pcap=/usr/local to force all programs to be linked
1753 # with a static version installed in /usr/local/lib rather than
1754 # the system version in /usr/lib).
1757 set(CMAKE_EXE_LINKER_FLAGS
1758 "-Wl,-headerpad_max_install_names -Wl,-search_paths_first ${CMAKE_EXE_LINKER_FLAGS}"
1761 # Add files to the app bundle
1762 # Wireshark.app/Contents
1763 file(WRITE ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo "APPLWshk\n")
1764 set(BUNDLE_CONTENTS_FILES
1765 ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo
1767 set_source_files_properties(${BUNDLE_CONTENTS_FILES} PROPERTIES
1768 MACOSX_PACKAGE_LOCATION .
1771 # Wireshark.app/Contents/Resources
1772 set(BUNDLE_RESOURCE_FILES
1773 ${CMAKE_SOURCE_DIR}/packaging/macosx/Resources/Wireshark.icns
1774 ${CMAKE_SOURCE_DIR}/packaging/macosx/Resources/Wiresharkdoc.icns
1776 set_source_files_properties(${BUNDLE_RESOURCE_FILES} PROPERTIES
1777 MACOSX_PACKAGE_LOCATION Resources
1780 # Wireshark.app/Contents/Resources/share/man/man1
1781 set(BUNDLE_RESOURCE_SHARE_MAN1_FILES ${MAN1_FILES})
1782 set_source_files_properties(${BUNDLE_RESOURCE_SHARE_MAN1_FILES} PROPERTIES
1783 MACOSX_PACKAGE_LOCATION Resources/share/man/man1
1786 # Wireshark.app/Contents/Resources/share/man/man1
1787 set(BUNDLE_RESOURCE_SHARE_MAN4_FILES ${MAN4_FILES})
1788 set_source_files_properties(${BUNDLE_RESOURCE_SHARE_MAN4_FILES} PROPERTIES
1789 MACOSX_PACKAGE_LOCATION Resources/share/man/man4
1792 # INSTALL_FILES and INSTALL_DIRS are handled by copy_data_files
1794 set(EXTRA_BUNDLE_FILES
1795 ${BUNDLE_CONTENTS_FILES}
1796 ${BUNDLE_RESOURCE_FILES}
1797 ${BUNDLE_RESOURCE_SHARE_MAN1_FILES}
1798 ${BUNDLE_RESOURCE_SHARE_MAN4_FILES}
1801 set(EXTRA_BUNDLE_FILES)
1804 if(BUILD_wireshark AND QT_FOUND)
1811 ${GTHREAD2_LIBRARIES}
1814 ${APPLE_APPLICATION_SERVICES_LIBRARY}
1815 ${APPLE_CORE_FOUNDATION_LIBRARY}
1816 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
1820 # Policy since 2.8.11
1822 cmake_policy(SET CMP0020 NEW)
1825 add_executable(wireshark WIN32 MACOSX_BUNDLE wireshark-qt.cpp ${wireshark_FILES} ${EXTRA_BUNDLE_FILES})
1826 set(PROGLIST ${PROGLIST} wireshark)
1827 set_target_properties(wireshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1828 set_target_properties(wireshark PROPERTIES FOLDER "Executables")
1829 if(ENABLE_APPLICATION_BUNDLE OR WIN32)
1830 set_target_properties(wireshark PROPERTIES OUTPUT_NAME Wireshark)
1833 if(ENABLE_APPLICATION_BUNDLE)
1834 set_target_properties(
1835 wireshark PROPERTIES
1836 MACOSX_BUNDLE_INFO_PLIST ${CMAKE_BINARY_DIR}/packaging/macosx/Info.plist
1838 # Add a wrapper script which opens the bundle. This adds
1839 # convenience but makes debugging more difficult.
1840 file(REMOVE ${CMAKE_BINARY_DIR}/run/wireshark)
1841 file(WRITE ${CMAKE_BINARY_DIR}/run/wireshark "#!/bin/sh\n")
1842 file(APPEND ${CMAKE_BINARY_DIR}/run/wireshark "open ${CMAKE_BINARY_DIR}/run/Wireshark.app --args \"\$\@\"\n")
1843 execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/wireshark)
1846 target_link_libraries(wireshark ${wireshark_LIBS})
1849 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1850 BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
1853 if(NOT ENABLE_APPLICATION_BUNDLE)
1854 # Map for endpoints dialog
1858 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1859 "${PROJECT_SOURCE_DIR}/ipmap.html"
1860 $<TARGET_FILE_DIR:wireshark>
1864 if(WIN32 AND Qt5Core_FOUND)
1865 # Use windeployqt to copy our required DLLs to the run path.
1866 # Ideally one of the modules in ${QTDIR}/lib/cmake would expose
1867 # the path to windeployqt. For that matter having a reliable
1868 # path to qmake would be *amazingly convenient*. We don't have
1869 # either of those so we try to discover the path via Qt5Core.
1870 # http://stackoverflow.com/questions/24650936/qt5-with-cmake-how-to-find-qt-translations-dir
1872 get_target_property(_qmake_location Qt5::qmake IMPORTED_LOCATION)
1873 get_filename_component(_qt_bin_path "${_qmake_location}" DIRECTORY)
1874 find_program(QT_WINDEPLOYQT_EXECUTABLE windeployqt
1875 HINTS "${_qmake_location}"
1876 DOC "Path to the windeployqt utility."
1878 if (NOT "${QT_WINDEPLOYQT_EXECUTABLE}" STREQUAL "QT_WINDEPLOYQT_EXECUTABLE-NOTFOUND")
1879 set(QT_BIN_PATH "${_qt_bin_path}" CACHE INTERNAL
1880 "Path to qmake, windeployqt, and other Qt utilities."
1882 add_custom_target(copy_qt_dlls ALL)
1883 set_target_properties(copy_qt_dlls PROPERTIES FOLDER "Copy Tasks")
1884 # Will we ever need to use --debug? Windeployqt seems to
1885 # be smart enough to copy debug DLLs when needed.
1886 add_custom_command(TARGET copy_qt_dlls
1888 COMMAND set "PATH=%PATH%;${QT_BIN_PATH}"
1889 COMMAND "${QT_WINDEPLOYQT_EXECUTABLE}"
1890 $<$<CONFIG:Debug>:--debug>
1891 $<$<NOT:$<CONFIG:Debug>>:--release>
1892 --no-compiler-runtime
1894 "$<TARGET_FILE:wireshark>"
1896 add_dependencies(copy_qt_dlls wireshark)
1898 endif(WIN32 AND Qt5Core_FOUND)
1901 # Common properties for CLI executables
1902 macro(set_extra_executable_properties _executable _folder)
1903 set_target_properties(${_executable} PROPERTIES
1904 LINK_FLAGS "${WS_LINK_FLAGS}"
1908 set(PROGLIST ${PROGLIST} ${_executable})
1910 if(ENABLE_APPLICATION_BUNDLE)
1911 set_target_properties(${_executable} PROPERTIES
1912 RUNTIME_OUTPUT_DIRECTORY run/Wireshark.app/Contents/MacOS
1914 # Add a wrapper script which runs each executable from the
1915 # correct location. This adds convenience but makes debugging
1917 file(REMOVE ${CMAKE_BINARY_DIR}/run/${_executable})
1918 file(WRITE ${CMAKE_BINARY_DIR}/run/${_executable} "#!/bin/sh\n")
1919 file(APPEND ${CMAKE_BINARY_DIR}/run/${_executable} "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/${_executable} \"\$\@\"\n")
1920 execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/${_executable})
1924 macro(set_extcap_executable_properties _executable)
1925 set_target_properties(${_executable} PROPERTIES FOLDER "Executables/Extcaps")
1927 set(PROGLIST ${PROGLIST} ${_executable})
1930 set_target_properties(${_executable} PROPERTIES
1931 LINK_FLAGS "${WS_LINK_FLAGS}"
1932 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/extcap
1933 RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/run/Debug/extcap
1934 RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/run/Release/extcap
1935 RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_BINARY_DIR}/run/MinSizeRel/extcap
1936 RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/run/RelWithDebInfo/extcap
1939 set_target_properties(${_executable} PROPERTIES
1940 LINK_FLAGS "${WS_LINK_FLAGS}"
1941 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/extcap
1943 if(ENABLE_APPLICATION_BUNDLE)
1944 set_target_properties(${_executable} PROPERTIES
1945 RUNTIME_OUTPUT_DIRECTORY run/Wireshark.app/Contents/MacOS/extcap
1947 # Add a wrapper script which runs each executable from the
1948 # correct location. This adds convenience but makes debugging
1950 file(REMOVE ${CMAKE_BINARY_DIR}/run/${_executable})
1951 file(WRITE ${CMAKE_BINARY_DIR}/run/${_executable} "#!/bin/sh\n")
1952 file(APPEND ${CMAKE_BINARY_DIR}/run/${_executable} "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/extcap/${_executable} \"\$\@\"\n")
1953 execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/${_executable})
1958 if(BUILD_wireshark_gtk AND GTK_FOUND)
1959 set(wireshark_gtk_LIBS
1966 ${GTHREAD2_LIBRARIES}
1968 ${PORTAUDIO_LIBRARIES}
1970 ${APPLE_APPLICATION_SERVICES_LIBRARY}
1971 ${APPLE_CORE_SERVICES_LIBRARY}
1972 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
1974 ${WIN_COMCTL32_LIBRARY}
1976 # wireshark and wireshark-gtk share wireshark_FILES
1978 add_executable(wireshark-gtk WIN32 ${wireshark_FILES})
1979 set(PROGLIST ${PROGLIST} wireshark-gtk)
1980 set_target_properties(wireshark-gtk PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1981 set_target_properties(wireshark-gtk PROPERTIES FOLDER "Executables")
1982 target_link_libraries(wireshark-gtk ${wireshark_gtk_LIBS})
1983 install(TARGETS wireshark-gtk RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1985 # Map for endpoints dialog
1987 TARGET wireshark-gtk
1989 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1990 "${PROJECT_SOURCE_DIR}/ipmap.html"
1991 $<TARGET_FILE_DIR:wireshark-gtk>
1995 get_target_property(_wsgtk_location wireshark-gtk LOCATION)
1996 get_filename_component(_dll_output_dir "${_wsgtk_location}" PATH)
1997 add_custom_target(copy_gtk_dlls)
1998 set_target_properties(copy_gtk_dlls PROPERTIES FOLDER "Copy Tasks")
1999 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2000 COMMAND ${CMAKE_COMMAND} -E make_directory "${_dll_output_dir}"
2004 set(_gtk_dll_dir "${GTK2_DLL_DIR}")
2005 set(_gtk_etc_dir "${GTK2_ETC_DIR}")
2006 set(_gtk_dlls "${GTK2_DLLS}")
2007 set(_gtk_etc_dir "${GTK2_ETC_DIR}")
2009 set(_gtk_dll_dir "${GTK3_DLL_DIR}")
2010 set(_gtk_dlls "${GTK3_DLLS}")
2011 set(_gtk_etc_dir "${GTK3_ETC_DIR}")
2014 foreach(_dll ${_gtk_dlls})
2015 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2016 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2017 "${_gtk_dll_dir}/${_dll}" "${_dll_output_dir}"
2022 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2023 COMMAND ${CMAKE_COMMAND} -E make_directory "${_dll_output_dir}/etc"
2025 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2026 COMMAND ${CMAKE_COMMAND} -E copy_directory
2027 "${_gtk_etc_dir}" "${_dll_output_dir}/etc"
2030 # XXX - Omitting ${GTK2_LIB_DIR}\loaders copying from Makefile.nmake
2033 set (_engines_output_dir "${_dll_output_dir}/lib/gtk-2.0/2.10.0/engines")
2034 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2035 COMMAND ${CMAKE_COMMAND} -E make_directory "${_engines_output_dir}"
2037 foreach(_dll ${GTK2_ENGINES_DLLS})
2038 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2039 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2040 "${GTK2_ENGINES_DLL_DIR}/${_dll}" "${_engines_output_dir}"
2045 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2046 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2047 "${GTK2_THEMES_DIR}/gtkrc" "${_dll_output_dir}/etc/gtk-2.0"
2051 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2052 COMMAND ${CMAKE_COMMAND} -E copy_directory
2053 "${GTK2_LIB_DIR}" "${_dll_output_dir}/lib/gtk-2.0"
2056 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2057 COMMAND ${CMAKE_COMMAND} -E copy_directory
2058 "${CMAKE_SOURCE_DIR}/ui/win32/settings.ini" "${_dll_output_dir}/etc"
2062 add_dependencies(wireshark-gtk copy_gtk_dlls copy_cli_dlls)
2066 register_tap_files(tshark-tap-register.c
2077 ${APPLE_CORE_FOUNDATION_LIBRARY}
2078 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
2083 tshark-tap-register.c
2087 ${CMAKE_BINARY_DIR}/image/tshark.rc
2089 add_executable(tshark ${tshark_FILES})
2090 set_extra_executable_properties(tshark "Executables")
2091 target_link_libraries(tshark ${tshark_LIBS})
2092 install(TARGETS tshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2099 ${APPLE_CORE_FOUNDATION_LIBRARY}
2100 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
2106 ${CMAKE_BINARY_DIR}/image/tfshark.rc
2108 add_executable(tfshark ${tfshark_FILES})
2109 set_extra_executable_properties(tfshark "Executables")
2110 target_link_libraries(tfshark ${tfshark_LIBS})
2111 install(TARGETS tfshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2114 if(BUILD_rawshark AND PCAP_FOUND)
2118 ${APPLE_CORE_FOUNDATION_LIBRARY}
2119 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
2125 ${CMAKE_BINARY_DIR}/image/rawshark.rc
2127 add_executable(rawshark ${rawshark_FILES})
2128 set_extra_executable_properties(rawshark "Executables")
2129 target_link_libraries(rawshark ${rawshark_LIBS})
2130 install(TARGETS rawshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2141 add_executable(dftest ${dftest_FILES})
2142 set_extra_executable_properties(dftest "Tests")
2143 target_link_libraries(dftest ${dftest_LIBS})
2144 install(TARGETS dftest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2163 add_executable(randpkt ${randpkt_FILES})
2164 set_extra_executable_properties(randpkt "Executables")
2165 target_link_libraries(randpkt ${randpkt_LIBS})
2166 install(TARGETS randpkt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2175 set(text2pcap_CLEAN_FILES
2180 ${text2pcap_CLEAN_FILES}
2181 ${CMAKE_BINARY_DIR}/image/text2pcap.rc
2183 add_lex_files(text2pcap_FILES
2186 add_executable(text2pcap ${text2pcap_FILES})
2187 set_extra_executable_properties(text2pcap "Executables")
2188 target_link_libraries(text2pcap ${text2pcap_LIBS})
2189 install(TARGETS text2pcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2200 ${CMAKE_BINARY_DIR}/image/mergecap.rc
2202 add_executable(mergecap ${mergecap_FILES})
2203 set_extra_executable_properties(mergecap "Executables")
2204 target_link_libraries(mergecap ${mergecap_LIBS})
2205 install(TARGETS mergecap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2208 if(BUILD_reordercap)
2214 set(reordercap_FILES
2216 ${CMAKE_BINARY_DIR}/image/reordercap.rc
2218 add_executable(reordercap ${reordercap_FILES})
2219 set_extra_executable_properties(reordercap "Executables")
2220 target_link_libraries(reordercap ${reordercap_LIBS})
2221 install(TARGETS reordercap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2234 ${CMAKE_BINARY_DIR}/image/capinfos.rc
2236 add_executable(capinfos ${capinfos_FILES})
2237 set_extra_executable_properties(capinfos "Executables")
2238 target_link_libraries(capinfos ${capinfos_LIBS})
2239 install(TARGETS capinfos RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2251 ${CMAKE_BINARY_DIR}/image/captype.rc
2253 add_executable(captype ${captype_FILES})
2254 set_extra_executable_properties(captype "Executables")
2255 target_link_libraries(captype ${captype_LIBS})
2256 install(TARGETS captype RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2267 ${CMAKE_BINARY_DIR}/image/editcap.rc
2269 add_executable(editcap ${editcap_FILES})
2270 set_extra_executable_properties(editcap "Executables")
2271 target_link_libraries(editcap ${editcap_LIBS})
2272 install(TARGETS editcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2275 if(BUILD_dumpcap AND PCAP_FOUND)
2284 ${GTHREAD2_LIBRARIES}
2286 ${APPLE_CORE_FOUNDATION_LIBRARY}
2287 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
2292 capture_stop_conditions.c
2299 ${CMAKE_BINARY_DIR}/image/dumpcap.rc
2301 add_executable(dumpcap ${dumpcap_FILES})
2302 set_extra_executable_properties(dumpcap "Executables")
2303 target_link_libraries(dumpcap ${dumpcap_LIBS})
2304 install(TARGETS dumpcap
2305 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
2306 PERMISSIONS ${DUMPCAP_SETUID}
2307 OWNER_READ OWNER_WRITE OWNER_EXECUTE
2308 GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
2310 if(DUMPCAP_INSTALL_OPTION STREQUAL "capabilities")
2311 install( CODE "execute_process(
2313 ${SETCAP_EXECUTABLE}
2314 cap_net_raw,cap_net_admin+ep
2315 ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/dumpcap${CMAKE_EXECUTABLE_SUFFIX}
2319 if( _SETCAP_RESULT )
2320 message( WARNING \"setcap failed (${_SETCAP_RESULT}).\")
2327 find_package( MSVC_REDIST )
2329 # Must come after executable targets are defined.
2330 find_package( NSIS )
2332 if (NOT "${MAKENSIS_EXECUTABLE}" STREQUAL "MAKENSIS_EXECUTABLE-NOTFOUND")
2333 add_subdirectory( packaging/nsis EXCLUDE_FROM_ALL )
2334 ADD_NSIS_UNINSTALLER_TARGET()
2335 ADD_NSIS_PACKAGE_TARGET()
2338 find_package( PortableApps )
2340 NOT "${PORTABLEAPPS_LAUNCHER_GENERATOR_EXECUTABLE}" STREQUAL "PORTABLEAPPS_LAUNCHER_GENERATOR_EXECUTABLE-NOTFOUND"
2342 NOT "${PORTABLEAPPS_INSTALLER_EXECUTABLE}" STREQUAL "PORTABLEAPPS_INSTALLER_EXECUTABLE-NOTFOUND"
2344 add_subdirectory( packaging/portableapps EXCLUDE_FROM_ALL )
2345 ADD_PORTABLEAPPS_PACKAGE_TARGET()
2349 if(BUILD_androiddump)
2350 if(EXTCAP_ANDROIDDUMP_LIBPCAP)
2352 set(androiddump_LIBS
2357 message(FATAL_ERROR "You try to build androiddump with libpcap but do not have it")
2360 set(androiddump_LIBS
2366 set(androiddump_FILES
2367 extcap/androiddump.c
2370 add_executable(androiddump WIN32 ${androiddump_FILES})
2371 # XXX Shouldn't we add wsutil to androiddump_LIBS instead?
2372 set_extcap_executable_properties(androiddump)
2373 target_link_libraries(androiddump ${androiddump_LIBS})
2374 install(TARGETS androiddump RUNTIME DESTINATION ${EXTCAP_DIR})
2377 if(BUILD_sshdump AND LIBSSH_FOUND)
2384 set(sshdump_LIBS wsutil ${sshdump_LIBS})
2390 add_executable(sshdump WIN32 ${sshdump_FILES})
2391 set_extcap_executable_properties(sshdump)
2392 target_link_libraries(sshdump ${sshdump_LIBS})
2393 target_include_directories(sshdump PUBLIC ${LIBSSH_INCLUDE_DIR})
2394 install(TARGETS sshdump RUNTIME DESTINATION ${EXTCAP_DIR})
2395 elseif (BUILD_sshdump)
2396 #message( WARNING "Cannot find libssh, cannot build sshdump" )
2399 if(BUILD_randpktdump)
2400 set(randpktdump_LIBS
2405 set(randpktdump_FILES
2406 extcap/randpktdump.c
2410 add_executable(randpktdump WIN32 ${randpktdump_FILES})
2411 # XXX Shouldn't we add wsutil to randpktdump_LIBS instead?
2412 set_extcap_executable_properties(randpktdump)
2413 target_link_libraries(randpktdump ${randpktdump_LIBS})
2414 install(TARGETS randpktdump RUNTIME DESTINATION ${EXTCAP_DIR})
2418 OUTPUT ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2419 COMMAND ${PERL_EXECUTABLE}
2420 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
2421 ${CMAKE_SOURCE_DIR}/doc/make-authors-short.pl
2422 < ${CMAKE_SOURCE_DIR}/AUTHORS
2423 > ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2425 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
2426 ${CMAKE_SOURCE_DIR}/doc/make-authors-short.pl
2427 ${CMAKE_SOURCE_DIR}/AUTHORS
2431 OUTPUT ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2432 COMMAND ${PERL_EXECUTABLE}
2433 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
2434 ${CMAKE_SOURCE_DIR}/doc/make-authors-format.pl
2435 < ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2436 > ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2438 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
2439 ${CMAKE_SOURCE_DIR}/doc/make-authors-format.pl
2440 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2444 FILE(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template WPT_WIN_PATH)
2445 FILE(TO_NATIVE_PATH ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT ASF_WIN_PATH)
2446 FILE(TO_NATIVE_PATH ${CMAKE_BINARY_DIR}/wireshark.pod WP_WIN_PATH)
2448 OUTPUT ${CMAKE_BINARY_DIR}/wireshark.pod
2449 COMMAND copy /B ${WPT_WIN_PATH} + ${ASF_WIN_PATH} ${WP_WIN_PATH}
2451 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
2452 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2457 OUTPUT ${CMAKE_BINARY_DIR}/wireshark.pod
2459 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
2460 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2461 > ${CMAKE_BINARY_DIR}/wireshark.pod
2463 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
2464 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2468 if(ENABLE_APPLICATION_BUNDLE)
2469 add_custom_target(app_bundle)
2470 set_target_properties(app_bundle PROPERTIES FOLDER "Copy Tasks")
2471 add_custom_command(TARGET app_bundle
2473 COMMAND "${CMAKE_SOURCE_DIR}/packaging/macosx/osx-app.sh"
2474 WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/run"
2476 add_dependencies(app_bundle ${PROGLIST})
2478 add_custom_target(dmg_package_prep DEPENDS app_bundle)
2481 OUTPUT ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo
2482 COMMAND ${CMAKE_COMMAND} -E echo APPLWshk > ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo
2485 ADD_CUSTOM_TARGET( dmg_package
2486 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2487 "${PROJECT_SOURCE_DIR}/ipmap.html"
2488 $<TARGET_FILE_DIR:wireshark>
2489 COMMAND ${CMAKE_COMMAND} -E copy_directory
2490 ${CMAKE_SOURCE_DIR}/packaging/macosx/ChmodBPF
2491 ${CMAKE_BINARY_DIR}/run/ChmodBPF
2492 COMMAND ${CMAKE_COMMAND} -E copy_directory
2493 ${CMAKE_SOURCE_DIR}/packaging/macosx/Resources
2494 ${CMAKE_BINARY_DIR}/run/Resources
2495 COMMAND ${CMAKE_COMMAND} -E copy_directory
2496 ${CMAKE_SOURCE_DIR}/packaging/macosx/Scripts
2497 ${CMAKE_BINARY_DIR}/run/Scripts
2498 COMMAND ${CMAKE_COMMAND} -E copy_directory
2499 ${CMAKE_SOURCE_DIR}/packaging/macosx/utility-launcher
2500 ${CMAKE_BINARY_DIR}/run/utility-launcher
2501 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2502 ${CMAKE_SOURCE_DIR}/COPYING
2503 ${CMAKE_BINARY_DIR}/run/COPYING.txt
2504 COMMAND ${CMAKE_COMMAND} -E copy_directory
2505 ${CMAKE_SOURCE_DIR}/packaging/macosx/Wireshark_package.pmdoc
2506 ${CMAKE_BINARY_DIR}/run/Wireshark_package.pmdoc
2507 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2508 ${CMAKE_BINARY_DIR}/packaging/macosx/Wireshark_package.pmdoc/index.xml
2509 ${CMAKE_BINARY_DIR}/run/Wireshark_package.pmdoc/index.xml
2510 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2511 ${CMAKE_SOURCE_DIR}/packaging/macosx/dmg_background.png
2512 ${CMAKE_BINARY_DIR}/run/dmg_background.png
2513 COMMAND bash -x ${CMAKE_BINARY_DIR}/packaging/macosx/osx-dmg.sh
2514 --source-directory ${CMAKE_SOURCE_DIR}/packaging/macosx
2515 # Unlike nsis_package_prep + nsis_package, we can add a direct
2517 DEPENDS dmg_package_prep
2518 # We create Wireshark.app in "run". Do our work there.
2519 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/run
2524 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/androiddump 1 )
2525 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/capinfos 1 )
2526 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/captype 1 )
2527 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dftest 1 )
2528 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dumpcap 1 )
2529 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/editcap 1 )
2530 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/extcap 4 )
2531 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/asn2deb 1 )
2532 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2deb 1 )
2533 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2wrs 1 )
2534 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/mergecap 1 )
2535 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/randpkt 1 )
2536 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/randpktdump 1 )
2537 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/rawshark 1 )
2538 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/reordercap 1 )
2539 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/sshdump 1 )
2540 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/text2pcap 1 )
2541 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/tshark 1 )
2542 pod2manhtml( ${CMAKE_BINARY_DIR}/wireshark 1 )
2543 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/wireshark-filter 4 )
2548 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2567 wireshark-filter.html
2569 set_target_properties(html_docs PROPERTIES FOLDER "Docs")
2577 ${randpktdump_FILES}
2578 ${text2pcap_CLEAN_FILES}
2584 ${androiddump_FILES}
2588 if (WERROR_COMMON_FLAGS)
2589 set_source_files_properties(
2592 COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
2600 ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
2607 ${CMAKE_INSTALL_MANDIR}/man1
2614 ${CMAKE_INSTALL_MANDIR}/man4
2619 "${CMAKE_BINARY_DIR}/wireshark.pc"
2621 ${CMAKE_INSTALL_LIBDIR}/pkgconfig
2627 DIRECTORY_PERMISSIONS
2628 OWNER_EXECUTE OWNER_WRITE OWNER_READ
2629 GROUP_EXECUTE GROUP_READ
2630 WORLD_EXECUTE WORLD_READ
2632 ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
2633 PATTERN ".git" EXCLUDE
2634 PATTERN ".svn" EXCLUDE
2635 PATTERN "Makefile.*" EXCLUDE
2636 PATTERN "faq.py" EXCLUDE
2639 include( UseCheckAPI )
2645 set(CMAKE_INSTALL_MODULES_DIR ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME})
2646 configure_file("${CMAKE_MODULE_PATH}/WiresharkConfig.cmake.in" "${CMAKE_BINARY_DIR}/WiresharkConfig.cmake" @ONLY)
2647 configure_file("${CMAKE_MODULE_PATH}/WiresharkConfigVersion.cmake.in" "${CMAKE_BINARY_DIR}/WiresharkConfigVersion.cmake" @ONLY)
2650 ${CMAKE_MODULE_PATH}/FindGLIB2.cmake
2651 ${CMAKE_MODULE_PATH}/FindWireshark.cmake
2652 ${CMAKE_MODULE_PATH}/FindWSWinLibs.cmake
2653 ${CMAKE_MODULE_PATH}/UseAsn2Wrs.cmake
2654 ${CMAKE_MODULE_PATH}/LocatePythonModule.cmake
2655 ${CMAKE_MODULE_PATH}/UseMakeDissectorReg.cmake
2656 ${CMAKE_BINARY_DIR}/WiresharkConfig.cmake
2657 ${CMAKE_BINARY_DIR}/WiresharkConfigVersion.cmake
2659 ${CMAKE_INSTALL_MODULES_DIR}
2663 message(STATUS "Docdir install: ${DOC_DIR}")
2666 ${CMAKE_BINARY_DIR}/docbook/
2667 DIRECTORY_PERMISSIONS
2668 OWNER_EXECUTE OWNER_WRITE OWNER_READ
2669 GROUP_EXECUTE GROUP_READ
2670 WORLD_EXECUTE WORLD_READ
2678 # Test suite wrapper
2679 if(ENABLE_APPLICATION_BUNDLE)
2680 set(TEST_SH_BIN_DIR ${CMAKE_BINARY_DIR}/run)
2682 set(TEST_SH_BIN_DIR $<TARGET_FILE_DIR:epan>)
2685 add_custom_target(test-sh
2686 COMMAND ${CMAKE_COMMAND}
2687 -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
2688 -DTEST_SH_BIN_DIR=${TEST_SH_BIN_DIR}
2689 -DTEST_SH_SRC_DIR=${CMAKE_SOURCE_DIR}/test
2690 -P ${CMAKE_SOURCE_DIR}/cmake/modules/GenerateTestSh.cmake
2691 DEPENDS ${CMAKE_SOURCE_DIR}/cmake/modules/GenerateTestSh.cmake
2693 set_target_properties(test-sh PROPERTIES FOLDER "Tests")
2695 add_custom_target(test-programs
2702 COMMENT "Building unit test programs and wrapper"
2704 set_target_properties(test-programs PROPERTIES FOLDER "Tests")
2707 file (TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/tools/Get-HardenFlags.ps1 _win_harden_flags)
2708 add_custom_target(hardening-check
2709 COMMAND ${POWERSHELL_COMMAND} "${_win_harden_flags}" "${_dll_output_dir_win}"
2711 COMMENT "Checking binaries for security features"
2713 set_target_properties(hardening-check PROPERTIES FOLDER "Tests")
2715 find_program(HARDENING_CHECK_EXECUTABLE hardening-check
2716 DOC "Path to the hardening-check utility."
2718 if (NOT "${HARDENING_CHECK_EXECUTABLE}" STREQUAL "HARDENING_CHECK_EXECUTABLE-NOTFOUND")
2719 foreach(_prog ${PROGLIST})
2720 get_target_property(_prog_dir ${_prog} RUNTIME_OUTPUT_DIRECTORY)
2721 if ("${_prog_dir}" STREQUAL "_prog_dir-NOTFOUND")
2722 set(_prog_dir "${CMAKE_BINARY_DIR}/run")
2724 set(_prog_paths ${_prog_paths} "${_prog_dir}/${_prog}")
2726 add_custom_target(hardening-check
2727 COMMAND ${HARDENING_CHECK_EXECUTABLE} ${_prog_paths}
2729 COMMENT "Checking binaries for security features"
2735 # Editor modelines - http://www.wireshark.org/tools/modelines.html
2740 # indent-tabs-mode: t
2743 # vi: set shiftwidth=8 tabstop=8 noexpandtab:
2744 # :indentSize=8:tabSize=8:noTabs=false: