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-copatible -fvisibility-hidden first.
569 check_c_compiler_flag(-fvisibility=hidden FVHIDDEN)
571 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
574 # OK, try the Sun^WOracle C -xldscope=hidden
576 check_c_compiler_flag(-xldscope=hidden XLDSCOPEHIDDEN)
578 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -xldscope=hidden")
582 # If there is anything else, we might want to
583 # make a list of options to try, and try them
586 message(WARNING "Hiding shared library symbols is not supported by the compiler."
587 " All shared library symbols will be exported.")
592 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
593 set (C_UNUSED "__attribute__((unused))" )
599 if(NOT CMAKE_C_COMPILER_ID MATCHES "MSVC")
600 set(WIRESHARK_LD_FLAGS
606 # CMAKE_POSITION_INDEPENDENT_CODE is only supported starting with CMake
607 # 2.8.9. Do not add -pie automatically for older versions.
609 # XXX - are there other compilers that don't support -pie? It's
610 # not as if the only platforms we support are Windows and Linux....
612 if(NOT CMAKE_VERSION VERSION_LESS "2.8.9")
613 set(WIRESHARK_LD_FLAGS ${WIRESHARK_LD_FLAGS}
619 include(CheckCLinkerFlag)
621 # Sigh: Have to use THIS_FLAG instead of ${F} for some reason
622 foreach(THIS_FLAG ${WIRESHARK_LD_FLAGS})
623 set(F WS_LD_FLAG_${_C})
624 set(${F} ${THIS_FLAG})
625 set(V WS_LD_FLAG_VALID${_C})
626 check_c_linker_flag(${${F}} ${V})
628 set(WS_LINK_FLAGS "${WS_LINK_FLAGS} ${${F}}")
630 math(EXPR _C "${_C} + 1")
633 if(APPLE AND EXISTS /usr/local/opt/gettext)
634 # GLib on OS X requires libintl. Homebrew installs gettext (and
635 # libintl) in /usr/local/opt/gettext
636 include_directories(/usr/local/opt/gettext/include)
637 link_directories(/usr/local/opt/gettext/lib)
640 # The packagelist is doing some magic: If we add XXX to the packagelist, we
641 # - may optionally set XXX_OPTIONS to pass to the find_package command
642 # - will call FindXXX.cmake
643 # - return found libraries in XXX_LIBRARIES
644 # - return found include in XXX_INCLUDE_DIRS
647 #The minimum package list
648 set(PACKAGELIST Gettext M GLIB2 GMODULE2 GTHREAD2 LEX YACC Perl SED SH PythonInterp)
649 set(LEX_REQUIRED TRUE)
650 set(GLIB2_REQUIRED TRUE)
651 set(GLIB2_FIND_REQUIRED TRUE)
652 set(GLIB2_MIN_VERSION 2.14.0)
653 set(GTHREAD2_REQUIRED TRUE)
654 set(PythonInterp_FIND_VERSION 2)
655 set(Python_ADDITIONAL_VERSIONS 3)
656 set(YACC_REQUIRED TRUE)
662 set(PACKAGELIST ${PACKAGELIST} HtmlViewer)
664 set(PACKAGELIST ${PACKAGELIST} LIBSSH)
665 set(LIBSSH_OPTIONS "0.6")
668 set(PACKAGELIST ${PACKAGELIST} PCAP)
672 set(PACKAGELIST ${PACKAGELIST} AIRPCAP)
676 if(BUILD_wireshark_gtk)
678 set(PACKAGELIST ${PACKAGELIST} GTK3)
680 set(PACKAGELIST ${PACKAGELIST} GTK2)
681 set(GTK2_OPTIONS COMPONENTS gtk)
682 set(GTK2_FIND_VERSION 2.12)
683 set(GTK2_DEBUG false)
690 # Untested, may not work if CMAKE_PREFIX_PATH gets overwritten
691 # somewhere. The if WIN32 in this place is annoying as well.
693 set( QT5_BASE_PATH "$ENV{QT5_BASE_DIR}" )
694 set( CMAKE_PREFIX_PATH "${QT5_BASE_PATH}" )
696 set(PACKAGELIST ${PACKAGELIST}
705 set(PACKAGELIST ${PACKAGELIST} Qt5MacExtras)
708 set(PACKAGELIST ${PACKAGELIST} Qt5WinExtras)
712 set(PACKAGELIST ${PACKAGELIST} Qt4)
713 set(Qt4_OPTIONS 4.7.1 REQUIRED QtCore QtGui)
720 set(PACKAGELIST ${PACKAGELIST} SMI)
725 set(PACKAGELIST ${PACKAGELIST} GCRYPT)
726 # Minimum version needed.
727 set(GCRYPT_OPTIONS "1.4.2")
730 # GNU SSL/TLS support
732 set(PACKAGELIST ${PACKAGELIST} GNUTLS)
733 # Minimum version needed.
734 set(GNUTLS_OPTIONS "2.12.0")
739 set(PACKAGELIST ${PACKAGELIST} KERBEROS)
742 # Portable audio (GTK+ only)
743 if(ENABLE_PORTAUDIO AND BUILD_wireshark_gtk)
744 set(PACKAGELIST ${PACKAGELIST} PORTAUDIO)
748 # Prefer c-ares over adns
749 if(ENABLE_CARES) # C Asynchronouse resolver
750 set(PACKAGELIST ${PACKAGELIST} CARES)
751 elseif(ENABLE_ADNS) # Gnu asynchronous DNS
752 set(PACKAGELIST ${PACKAGELIST} ADNS)
758 # On Windows we build our own version of zlib, so add the paths
759 set(ZLIB_SRC_DIR "${_PROJECT_LIB_DIR}/zlib-1.2.8-ws")
760 add_subdirectory("${ZLIB_SRC_DIR}" "${CMAKE_BINARY_DIR}/zlib")
761 set(ZLIB_INCLUDE_DIR "${ZLIB_SRC_DIR}" "${CMAKE_BINARY_DIR}/zlib")
762 set(ZLIB_LIBRARY zlib)
763 set(ZLIB_DLL "zlib1.dll")
764 set_target_properties(zlib PROPERTIES FOLDER "Libs/zlib")
765 # Annoyingly zlib also builds some other stuff we aren't interested in
766 set_target_properties(zlibstatic PROPERTIES FOLDER "Libs/zlib")
768 set(PACKAGELIST ${PACKAGELIST} ZLIB)
771 # Embedded Lua interpreter
773 set(PACKAGELIST ${PACKAGELIST} LUA)
776 # GeoIP address resolving
778 set(PACKAGELIST ${PACKAGELIST} GEOIP)
782 set(PACKAGELIST ${PACKAGELIST} NL)
786 set(PACKAGELIST ${PACKAGELIST} SBC)
791 set(PACKAGELIST ${PACKAGELIST} CAP SETCAP)
794 # Windows version updates
795 if(ENABLE_WINSPARKLE)
796 set(PACKAGELIST ${PACKAGELIST} WINSPARKLE)
799 set(PACKAGELIST ${PACKAGELIST} YAPP)
801 set(PACKAGELIST ${PACKAGELIST} POD)
803 if(ENABLE_HTML_GUIDES)
804 set(PACKAGELIST ${PACKAGELIST} DOXYGEN)
809 # Sort the package list
810 list(SORT PACKAGELIST)
811 message(STATUS "Packagelist: ${PACKAGELIST}")
812 # Let's loop the package list
813 foreach(PACKAGE ${PACKAGELIST})
814 if(${PACKAGE} STREQUAL "Qt4")
815 set(PACKAGE_VAR "QT")
816 elseif(${PACKAGE} STREQUAL "PythonInterp")
817 set(PACKAGE_VAR "PYTHONINTERP")
818 elseif(${PACKAGE} STREQUAL "Gettext")
819 set(PACKAGE_VAR "GETTEXT")
820 elseif(${PACKAGE} STREQUAL "HtmlViewer")
821 set(PACKAGE_VAR "HTML_VIEWER")
822 elseif(${PACKAGE} STREQUAL "Perl")
823 set(PACKAGE_VAR "PERL")
825 set(PACKAGE_VAR ${PACKAGE})
827 if(${PACKAGE}_OPTIONS)
828 find_package(${PACKAGE} ${${PACKAGE}_OPTIONS})
829 elseif(${PACKAGE}_REQUIRED)
830 find_package(${PACKAGE} REQUIRED)
832 find_package(${PACKAGE})
834 if (${PACKAGE_VAR}_FOUND)
835 message(STATUS "${PACKAGE_VAR} FOUND")
836 set(HAVE_LIB${PACKAGE_VAR} 1)
837 include_directories(SYSTEM ${${PACKAGE_VAR}_INCLUDE_DIRS})
838 set(WS_ALL_LIBS ${WS_ALL_LIBS} ${${PACKAGE_VAR}_LIBRARIES})
839 message(STATUS "${PACKAGE} includes: ${${PACKAGE_VAR}_INCLUDE_DIRS}")
840 message(STATUS "${PACKAGE} libs: ${${PACKAGE_VAR}_LIBRARIES}")
841 if (${PACKAGE}_DEFINITIONS)
842 message(STATUS "${PACKAGE} definitions: ${${PACKAGE_VAR}_DEFINITIONS}")
844 if (${PACKAGE_VAR}_EXECUTABLE)
845 message(STATUS "${PACKAGE} executable: ${${PACKAGE_VAR}_EXECUTABLE}")
849 # Not finding a package is only a fatal error if the
850 # package is required; if it's required, then its
851 # XXX_REQUIRED variable is set to TRUE, and the above
852 # code will pass REQUIRED to find_package, and the
853 # configure will fail if the package isn't found.
855 # Do *NOT* report this as an error!
857 message(STATUS "${PACKAGE_VAR} NOT FOUND")
861 # Provide Windows system lib names
862 include( UseWinLibs )
865 include(CPackConfig.txt)
889 if(HAVE_LIBNL AND HAVE_AIRPCAP)
890 message(ERROR "Airpcap and Libnl support are mutually exclusive")
895 if(EXTCAP_ANDROIDDUMP_LIBPCAP)
896 set(ANDROIDDUMP_USE_LIBPCAP 1)
899 if (HAVE_LIBWINSPARKLE)
900 set(HAVE_SOFTWARE_UPDATE 1)
903 # No matter which version of GTK is present
904 if(GTK2_FOUND OR GTK3_FOUND)
907 # That's the name autofoo uses
910 # Always include the "true" zlib includes first. This works around a
911 # bug in the Windows setup of GTK[23] which has a faulty zconf.h.
912 include_directories(BEFORE ${ZLIB_INCLUDE_DIRS})
914 if (Qt5Widgets_FOUND)
916 # Qt5CoreConfigExtras.cmake in Qt 5.5.0 sets -fPIC unconditionally:
918 # https://bugreports.qt.io/browse/QTBUG-47942
920 # There's a fix in Gerrit for that:
922 # https://codereview.qt-project.org/#/c/139645/
924 # Do the same check as that fix does and, if the check says we
925 # should *not* add -fPIC, remove it.
927 # XXX - if that check gets changed in the future, we'll have to
928 # detect that and change it.
930 if (CMAKE_VERSION VERSION_LESS 2.8.12
931 AND (CMAKE_CXX_COMPILER_ID STREQUAL \"GNU\"
932 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))
934 # Yes, it should have been; leave it there.
938 # No, it shouldn't have been; remove it.
940 list(REMOVE_ITEM Qt5Widgets_EXECUTABLE_COMPILE_FLAGS "-fPIC")
942 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
944 set (QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES})
945 if(Qt5Multimedia_FOUND)
946 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5Multimedia_LIBRARIES})
947 # That's the name autofoo uses
948 set(QT_MULTIMEDIA_LIB 1)
951 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5Svg_LIBRARIES})
952 # That's the name autofoo uses
955 if(Qt5MacExtras_FOUND)
956 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5MacExtras_LIBRARIES})
957 # That's the name autofoo uses
958 set(QT_MACEXTRAS_LIB 1)
960 if(Qt5WinExtras_FOUND)
961 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5WinExtras_LIBRARIES})
962 # set(QT_WINEXTRAS_LIB 1) # Not needed?
964 # If Qt4: QT_LIBRARIES and QT_INCLUDES are not set above. They require extra magic
966 include(${QT_USE_FILE})
967 include_directories(${QT_INCLUDE_DIR})
968 message(STATUS "Qt includes: ${QT_INCLUDE_DIR}")
969 message(STATUS "Qt libs: ${QT_LIBRARIES}")
970 if(QT_QTMULTIMEDIA_FOUND)
971 include_directories(${QT_QTMULTIMEDIA_INCLUDE_DIR})
972 message(STATUS "QtMultimedia includes: ${QT_INCLUDE_DIR}")
973 set (QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMULTIMEDIA_LIBRARY})
974 message(STATUS "QtMultimedia libs: ${QT_QTMULTIMEDIA_LIBRARY}")
975 # That's the name autofoo uses
976 set(QT_MULTIMEDIA_LIB 1)
980 message(STATUS "C-Flags: ${CMAKE_C_FLAGS}")
981 message(STATUS "CXX-Flags: ${CMAKE_CXX_FLAGS}")
982 message(STATUS "Warnings as errors: ${WERROR_COMMON_FLAGS}")
986 # We assume that APPLE means OS X so that we have the OS X
989 set(HAVE_OS_X_FRAMEWORKS 1)
990 FIND_LIBRARY (APPLE_APPLICATION_SERVICES_LIBRARY ApplicationServices)
991 FIND_LIBRARY (APPLE_CORE_FOUNDATION_LIBRARY CoreFoundation)
992 FIND_LIBRARY (APPLE_SYSTEM_CONFIGURATION_LIBRARY SystemConfiguration)
995 include(ConfigureChecks.cmake)
997 #Big or little endian ?
998 include(TestBigEndian)
999 test_big_endian(WORDS_BIGENDIAN)
1001 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
1003 add_subdirectory( asn1 EXCLUDE_FROM_ALL )
1004 add_subdirectory( capchild )
1005 add_subdirectory( caputils )
1006 add_subdirectory( codecs )
1007 add_subdirectory( docbook )
1008 add_subdirectory( epan )
1009 add_subdirectory( tools/lemon )
1010 add_subdirectory( ui )
1011 add_subdirectory( wiretap )
1012 add_subdirectory( wsutil )
1015 add_custom_target(dumpabi DEPENDS dumpabi-libwireshark dumpabi-libwiretap dumpabi-libwsutil color.h)
1019 add_subdirectory( echld )
1022 if(BUILD_wireshark_gtk AND GTK_FOUND)
1023 add_subdirectory( ui/gtk )
1026 if(BUILD_wireshark AND QT_FOUND)
1027 add_subdirectory( ui/qt )
1030 # Location of our data files. This should be set to a value that allows
1031 # running from the build directory on Windows, on OS X when building an
1032 # application bundle, and on UNIX if WIRESHARK_RUN_FROM_BUILD_DIRECTORY
1034 if(ENABLE_APPLICATION_BUNDLE)
1035 set(_datafile_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Resources/share/wireshark")
1037 get_target_property(_libwireshark_location epan LOCATION)
1038 get_filename_component(_datafile_dir "${_libwireshark_location}" PATH)
1041 set(DATAFILE_DIR ${_datafile_dir} CACHE INTERNAL "Build time data file location.")
1043 if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
1044 set(ABSOLUTE_CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
1046 set(ABSOLUTE_CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
1051 set(EXTCAP_DIR "${ABSOLUTE_CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/extcap/")
1055 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LIBSSH_LIBRARIES})
1056 CHECK_FUNCTION_EXISTS(ssh_userauth_agent LIBSSH_USERAUTH_AGENT_FOUND)
1057 if(LIBSSH_USERAUTH_AGENT_FOUND)
1058 set(HAVE_SSH_USERAUTH_AGENT 1)
1062 # Location of our plugins. PLUGIN_DIRECTORY should allow running
1063 # from the build directory similar to DATAFILE_DIR above.
1066 add_custom_target(plugins)
1067 set_target_properties(plugins PROPERTIES FOLDER "Plugins")
1068 set(PLUGIN_INSTALL_DIR "${ABSOLUTE_CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}")
1083 ${CUSTOM_PLUGIN_SRC_DIR}
1085 # It seems this stuff doesn't build with autofoo either...
1087 # set(PLUGIN_SRC_DIRS
1088 # ${PLUGIN_SRC_DIRS}
1093 set(PLUGIN_SRC_DIRS )
1096 if(ENABLE_APPLICATION_BUNDLE)
1097 set(_plugin_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/PlugIns/wireshark")
1099 get_target_property(_libwireshark_location epan LOCATION)
1100 get_filename_component(_plugin_dir "${_libwireshark_location}" PATH)
1101 set(_plugin_dir "${_plugin_dir}/plugins")
1103 # XXX The NMake environment appends the version. Should we do so here?
1104 set (PLUGIN_DIR ${_plugin_dir} CACHE INTERNAL "Build time plugin location.")
1106 foreach(_plugin_src_dir ${PLUGIN_SRC_DIRS})
1107 add_subdirectory( ${_plugin_src_dir} )
1111 # Basedir where to install guides
1112 set(DOC_DIR "$ENV{docdir}" CACHE FILEPATH "Installation directory for ug and dg pdfs.")
1113 message(STATUS "docdir: ${DOC_DIR}")
1115 if(ENABLE_PCAP_NG_DEFAULT)
1116 set(PCAP_NG_DEFAULT 1)
1119 # Large file support (e.g. make off_t 64 bit if supported)
1120 include(gmxTestLargeFiles)
1121 gmx_test_large_files(GMX_LARGEFILES)
1123 add_definitions( -DTOP_SRCDIR=\"${CMAKE_SOURCE_DIR}\" )
1126 set(WS_MSVC_NORETURN "__declspec(noreturn)")
1128 # Disable deprecation
1129 if(MSVC80 OR MSVC90)
1130 add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
1133 set(WS_MSVC_NORETURN " ")
1136 set( VERSION ${PROJECT_VERSION} )
1138 COMMAND ${PERL_EXECUTABLE}
1139 ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
1141 ${CMAKE_CURRENT_SOURCE_DIR}
1142 OUTPUT_VARIABLE VERSION_H_CONTENT
1144 set( configure_input "Built with CMake ${CMAKE_VERSION}" )
1145 configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h)
1146 configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_BINARY_DIR}/version.h)
1147 #set_target_properties(${CMAKE_BINARY_DIR}/version.h PROPERTIES FOLDER "Auxiliary")
1149 set(ICON_PATH "${CMAKE_SOURCE_DIR}/image/")
1152 capchild/doxygen.cfg.in
1153 caputils/doxygen.cfg.in
1157 image/libwireshark.rc.in
1158 image/text2pcap.rc.in
1159 image/capinfos.rc.in
1160 image/wireshark.rc.in
1161 image/mergecap.rc.in
1164 image/reordercap.rc.in
1165 image/rawshark.rc.in
1166 image/file_dlg_win32.rc
1170 image/libwscodecs.rc.in
1171 image/libwsutil.rc.in
1173 image/wireshark.exe.manifest.in
1174 packaging/macosx/Info.plist.in
1175 packaging/macosx/osx-dmg.sh.in
1176 packaging/macosx/Wireshark_package.pmdoc/index.xml.in
1178 ui/gtk/doxygen.cfg.in
1179 ui/qt/doxygen.cfg.in
1182 foreach( _in_file ${IN_FILES} )
1183 get_filename_component( _path ${_in_file} PATH )
1184 string( REGEX REPLACE "(.*)\\.in" "\\1" _outfile ${_in_file} )
1185 configure_file( ${CMAKE_SOURCE_DIR}/${_in_file} ${CMAKE_BINARY_DIR}/${_outfile} @ONLY )
1188 include(FeatureSummary)
1189 #SET_FEATURE_INFO(NAME DESCRIPTION [URL [COMMENT] ])
1190 SET_FEATURE_INFO(SBC "SBC Codec for Bluetooth A2DP stream playing" "www: http://git.kernel.org/cgit/bluetooth/sbc.git" )
1191 SET_FEATURE_INFO(LIBSSH "libssh is library for ssh connections and it is needed to build sshdump" "www: https://www.libssh.org/get-it/" )
1193 FEATURE_SUMMARY(WHAT ALL)
1196 ${CMAKE_BINARY_DIR}/ui
1197 ${CMAKE_BINARY_DIR}/ui/gtk
1198 ${CMAKE_BINARY_DIR}/ui/qt
1199 ${CMAKE_BINARY_DIR}/capchild
1200 ${CMAKE_BINARY_DIR}/caputils
1201 ${CMAKE_BINARY_DIR}/codecs
1202 ${CMAKE_BINARY_DIR}/epan
1203 ${CMAKE_BINARY_DIR}/wiretap
1204 ${CMAKE_BINARY_DIR}/wsutil
1209 ui/win32/console_win32.c
1210 ui/win32/file_dlg_win32.c
1211 ui/win32/print_win32.c
1213 set(PLATFORM_UI_RC_FILES
1214 image/file_dlg_win32.rc
1218 # sources common for wireshark, tshark, and rawshark
1219 set(SHARK_COMMON_SRC
1225 # sources for external capture interfaces
1227 set(SHARK_COMMON_SRC
1235 ui/cli/tap-camelsrt.c
1236 ui/cli/tap-comparestat.c
1237 ui/cli/tap-diameter-avp.c
1239 ui/cli/tap-endpoints.c
1242 ui/cli/tap-gsm_astat.c
1244 ui/cli/tap-httpstat.c
1245 ui/cli/tap-icmpstat.c
1246 ui/cli/tap-icmpv6stat.c
1248 ui/cli/tap-iousers.c
1249 ui/cli/tap-macltestat.c
1250 ui/cli/tap-protocolinfo.c
1251 ui/cli/tap-protohierstat.c
1252 ui/cli/tap-rlcltestat.c
1253 ui/cli/tap-rpcprogs.c
1256 ui/cli/tap-rtspstat.c
1257 ui/cli/tap-sctpchunkstat.c
1258 ui/cli/tap-simple_stattable.c
1259 ui/cli/tap-sipstat.c
1260 ui/cli/tap-smbsids.c
1262 ui/cli/tap-stats_tree.c
1264 ui/cli/tap-wspstat.c
1277 ${CMAKE_BINARY_DIR}/androiddump.html
1278 ${CMAKE_BINARY_DIR}/sshdump.html
1279 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
1280 ${CMAKE_BINARY_DIR}/capinfos.html
1281 ${CMAKE_BINARY_DIR}/captype.html
1285 ${CMAKE_BINARY_DIR}/dftest.html
1286 ${CMAKE_BINARY_DIR}/dumpcap.html
1287 ${CMAKE_BINARY_DIR}/editcap.html
1288 ${CMAKE_BINARY_DIR}/extcap.html
1289 ${CMAKE_BINARY_DIR}/asn2deb.html
1290 ${CMAKE_BINARY_DIR}/idl2deb.html
1291 ${CMAKE_BINARY_DIR}/idl2wrs.html
1294 ${CMAKE_BINARY_DIR}/mergecap.html
1296 ${CMAKE_BINARY_DIR}/randpkt.html
1297 ${CMAKE_BINARY_DIR}/rawshark.html
1298 ${CMAKE_BINARY_DIR}/reordercap.html
1301 ${CMAKE_BINARY_DIR}/text2pcap.html
1302 ${CMAKE_BINARY_DIR}/tshark.html
1303 ${CMAKE_BINARY_DIR}/wireshark-filter.html
1304 ${CMAKE_BINARY_DIR}/wireshark.html
1309 set(TEXTIFY_FILES COPYING NEWS README README.windows)
1310 foreach(_text_file ${TEXTIFY_FILES})
1311 set(INSTALL_FILES ${CMAKE_BINARY_DIR}/${_text_file}.txt ${INSTALL_FILES})
1314 set(INSTALL_FILES COPYING ${INSTALL_FILES})
1318 ${CMAKE_BINARY_DIR}/androiddump.1
1319 ${CMAKE_BINARY_DIR}/capinfos.1
1320 ${CMAKE_BINARY_DIR}/captype.1
1321 ${CMAKE_BINARY_DIR}/dftest.1
1322 ${CMAKE_BINARY_DIR}/dumpcap.1
1323 ${CMAKE_BINARY_DIR}/editcap.1
1324 ${CMAKE_BINARY_DIR}/extcap.4
1325 ${CMAKE_BINARY_DIR}/idl2wrs.1
1326 ${CMAKE_BINARY_DIR}/mergecap.1
1327 ${CMAKE_BINARY_DIR}/randpkt.1
1328 ${CMAKE_BINARY_DIR}/rawshark.1
1329 ${CMAKE_BINARY_DIR}/reordercap.1
1330 ${CMAKE_BINARY_DIR}/sshdump.1
1331 ${CMAKE_BINARY_DIR}/text2pcap.1
1332 ${CMAKE_BINARY_DIR}/tshark.1
1333 ${CMAKE_BINARY_DIR}/wireshark.1
1337 ${CMAKE_BINARY_DIR}/wireshark-filter.4
1341 # @NSL_LIBS@ # -lnsl
1342 # @SOCKET_LIBS@ # -lsocket
1343 # @SSL_LIBS@ # -lcrypto
1345 # $(plugin_ldadd) # in case of static
1346 ${AIRPCAP_LIBRARIES}
1350 ${KERBEROS_LIBRARIES}
1360 ${WINSPARKLE_LIBRARIES}
1364 # According to http://stackoverflow.com/questions/14474659/cmake-how-to-have-a-target-for-copying-files
1365 # we can't just use "set(_dll_output_dir "$<TARGET_FILE_DIR:epan>")"
1366 # DATAFILE_DIR is set using the same property. We could probably
1367 # get away with using it here.
1368 get_target_property(_libwireshark_location epan LOCATION)
1369 get_filename_component(_dll_output_dir "${_libwireshark_location}" PATH)
1370 add_custom_target(copy_cli_dlls)
1371 set_target_properties(copy_cli_dlls PROPERTIES FOLDER "Copy Tasks")
1372 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1373 COMMAND ${CMAKE_COMMAND} -E make_directory "${_dll_output_dir}"
1376 # XXX Can (and should) we iterate over these similar to the way
1377 # the top-level CMakeLists.txt iterates over the package list?
1380 # The cairo, freetype, gio, gnutls, png, and other OBS-generated DLLs
1381 # depend on zlib1.dll. We compile zlib locally but the Debug
1382 # configuration (the default) creates zlibd1.dll.
1383 file (TO_NATIVE_PATH "${_dll_output_dir}" _dll_output_dir_win )
1384 foreach( _dll ${GLIB2_DLLS} $<$<CONFIG:Debug>:zlib1.dll> )
1385 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1386 # It would be really handy if copy, xcopy, or "cmake
1387 # -E copy_if_different" supported multiple files
1388 # separated by whitespace, or if robocpy had a sane
1389 # notion of exit codes.
1390 COMMAND if exist \"${_dll}\" xcopy ${_dll} "${_dll_output_dir_win}" /D /Y
1391 WORKING_DIRECTORY "${GLIB2_DLL_DIR}"
1396 # Don't overwrite an exe if it's already there. We don't want to
1397 # clobber any previous code signing.
1398 file(GLOB _gspawn_helpers
1399 RELATIVE "${GLIB2_DLL_DIR}"
1400 "${GLIB2_DLL_DIR}/gspawn*.exe"
1402 foreach(_gspawn_helper ${_gspawn_helpers})
1403 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1404 COMMAND if not exist \"${_dll_output_dir_win}\\${_gspawn_helper}\" xcopy ${_gspawn_helper} "${_dll_output_dir_win}" /D /Y
1405 WORKING_DIRECTORY "${GLIB2_DLL_DIR}"
1411 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1412 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1413 "${AIRPCAP_DLL_DIR}/${AIRPCAP_DLL}"
1414 "${_dll_output_dir}"
1416 endif(AIRPCAP_FOUND)
1418 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1419 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1420 "${CARES_DLL_DIR}/${CARES_DLL}"
1421 "${_dll_output_dir}"
1425 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1426 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1427 "${GEOIP_DLL_DIR}/${GEOIP_DLL}"
1428 "${_dll_output_dir}"
1432 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1433 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1434 "${LIBSSH_DLL_DIR}/${LIBSSH_DLL}"
1435 "${_dll_output_dir}"
1439 foreach( _dll ${GCRYPT_DLLS} )
1440 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1441 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1442 "${GCRYPT_DLL_DIR}/${_dll}"
1443 "${_dll_output_dir}"
1448 foreach( _dll ${GNUTLS_DLLS} )
1449 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1450 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1451 "${GNUTLS_DLL_DIR}/${_dll}"
1452 "${_dll_output_dir}"
1457 foreach( _dll ${KERBEROS_DLLS} )
1458 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1459 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1460 "${KERBEROS_DLL_DIR}/${_dll}"
1461 "${_dll_output_dir}"
1464 endif(KERBEROS_FOUND)
1466 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1467 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1468 "${LUA_DLL_DIR}/${LUA_DLL}"
1469 "${_dll_output_dir}"
1473 # Wireshark.nsi wants SMI_DIR which is the base SMI directory
1474 get_filename_component(SMI_DIR ${SMI_DLL_DIR} DIRECTORY)
1475 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1476 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1477 "${SMI_DLL_DIR}/${SMI_DLL}"
1478 "${_dll_output_dir}"
1479 COMMAND ${CMAKE_COMMAND} -E make_directory
1480 "${_dll_output_dir}/snmp"
1481 COMMAND ${CMAKE_COMMAND} -E make_directory
1482 "${_dll_output_dir}/snmp/mibs"
1483 COMMAND ${CMAKE_COMMAND} -E copy_directory
1484 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/iana"
1485 "${_dll_output_dir}/snmp/mibs"
1486 COMMAND ${CMAKE_COMMAND} -E copy_directory
1487 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/ietf"
1488 "${_dll_output_dir}/snmp/mibs"
1489 COMMAND ${CMAKE_COMMAND} -E copy_directory
1490 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/irtf"
1491 "${_dll_output_dir}/snmp/mibs"
1492 COMMAND ${CMAKE_COMMAND} -E copy_directory
1493 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/site"
1494 "${_dll_output_dir}/snmp/mibs"
1495 COMMAND ${CMAKE_COMMAND} -E copy_directory
1496 "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/tubs"
1497 "${_dll_output_dir}/snmp/mibs"
1498 COMMAND ${CMAKE_COMMAND} -E copy_directory
1499 "${SMI_SHARE_DIR}/${SMI_DLL}/pibs"
1500 "${_dll_output_dir}/snmp/mibs"
1501 COMMAND ${CMAKE_COMMAND} -E copy_directory
1502 "${SMI_SHARE_DIR}/${SMI_DLL}/yang"
1503 "${_dll_output_dir}/snmp/mibs"
1506 if (WINSPARKLE_FOUND)
1507 add_custom_command(TARGET copy_cli_dlls PRE_BUILD
1508 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1509 "${WINSPARKLE_DLL_DIR}/${WINSPARKLE_DLL}"
1510 "${_dll_output_dir}"
1512 endif(WINSPARKLE_FOUND)
1514 add_dependencies(epan copy_cli_dlls)
1516 # We have a lot of choices for creating zip archives:
1517 # - 7z, WinZip, etc., which require a separate download+install.
1518 # - Cygwin's zip, which requires Cygwin.
1519 # - "CMake -E tar cz", which creates a tar file.
1520 # - CPack, which requires a CPack configuration.
1521 # - PowerShell via PSCX or System.IO.Compression.FileSystem.
1522 # - Python via zipfile.
1523 # For now, just look for 7z. It's installed on the Windows builders,
1524 # which might be the only systems that use this target.
1525 find_program(ZIP_EXECUTABLE 7z
1526 PATH "$ENV{PROGRAMFILES}/7-Zip" "$ENV{PROGRAMW6432}/7-Zip"
1527 DOC "Path to the 7z utility."
1529 # XXX "if(ZIP_EXECUTABLE)" doesn't work here. It looks like the
1530 # absence of "-NOTFOUND" doesn't equal "true".
1531 if (NOT "${ZIP_EXECUTABLE}" STREQUAL "ZIP_EXECUTABLE-NOTFOUND")
1532 add_custom_target(pdb_zip_package)
1533 set_target_properties(pdb_zip_package PROPERTIES FOLDER "Packaging")
1534 set(_pdb_zip "${CMAKE_BINARY_DIR}/Wireshark-pdb-${WIRESHARK_TARGET_PLATFORM}-${VERSION}.zip")
1535 file(TO_NATIVE_PATH "${_pdb_zip}" _pdb_zip_win)
1536 add_custom_command(TARGET pdb_zip_package POST_BUILD
1537 COMMAND ${CMAKE_COMMAND} -E remove -f "${_pdb_zip}"
1538 COMMAND ${ZIP_EXECUTABLE} a -tzip -mmt=on "${_pdb_zip_win}" *.pdb *.lib
1539 WORKING_DIRECTORY "${_dll_output_dir}"
1541 add_dependencies(pdb_zip_package epan)
1545 # List of extra dependencies for the "copy_data_files" target
1546 set(copy_data_files_depends)
1548 # glob patterns relative to the source directory that should be copied to
1549 # ${DATAFILE_DIR} (including directory prefixes)
1555 foreach(_text_file ${TEXTIFY_FILES})
1556 add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${_text_file}.txt
1557 COMMAND ${POWERSHELL_COMMAND} "${CMAKE_SOURCE_DIR}/tools/textify.ps1"
1558 -Destination ${CMAKE_BINARY_DIR}
1559 ${CMAKE_SOURCE_DIR}/${_text_file}
1561 ${CMAKE_SOURCE_DIR}/${_text_file}
1566 foreach(_install_file ${INSTALL_FILES})
1567 get_filename_component(_install_basename "${_install_file}" NAME)
1568 set(_output_file "${DATAFILE_DIR}/${_install_basename}")
1569 add_custom_command(OUTPUT "${_output_file}"
1570 COMMAND ${CMAKE_COMMAND} -E copy
1573 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
1578 list(APPEND copy_data_files_depends "${_output_file}")
1582 # Ensure "run/extcap" exists
1583 add_custom_command(OUTPUT "${DATAFILE_DIR}/extcap"
1584 COMMAND ${CMAKE_COMMAND} -E make_directory
1585 "${DATAFILE_DIR}/extcap"
1587 list(APPEND copy_data_files_depends "${DATAFILE_DIR}/extcap")
1590 file(TO_NATIVE_PATH "${DATAFILE_DIR}/help" _help_dest_dir)
1591 file(GLOB _help_files RELATIVE "${CMAKE_SOURCE_DIR}" "help/*.txt")
1592 foreach(_help_file IN LISTS _help_files)
1593 add_custom_command(OUTPUT "${DATAFILE_DIR}/${_help_file}"
1594 COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/help"
1595 COMMAND ${POWERSHELL_COMMAND} "${CMAKE_SOURCE_DIR}/tools/textify.ps1"
1596 -Destination "${_help_dest_dir}"
1597 "${CMAKE_SOURCE_DIR}/${_help_file}"
1599 "${CMAKE_SOURCE_DIR}/${_help_file}"
1601 list(APPEND copy_data_files_depends "${DATAFILE_DIR}/${_help_file}")
1604 list(APPEND DATA_FILES_SRC "help/*.txt")
1607 # Create help/faq.txt when missing
1608 add_custom_command(OUTPUT "${DATAFILE_DIR}/help/faq.txt"
1609 COMMAND ${CMAKE_COMMAND} -E make_directory "${DATAFILE_DIR}/help"
1610 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/help/faq.py -b > faq.tmp.html
1611 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/html2text.py
1612 faq.tmp.html > "${DATAFILE_DIR}/help/faq.txt"
1613 COMMAND ${CMAKE_COMMAND} -E remove faq.tmp.html
1615 "${CMAKE_SOURCE_DIR}/help/faq.py"
1616 "${CMAKE_SOURCE_DIR}/tools/html2text.py"
1618 list(APPEND copy_data_files_depends "${DATAFILE_DIR}/help/faq.txt")
1620 # Install LUA files in staging directory such that LUA can used when Wireshark
1621 # is ran from the build directory. For install targets, see
1622 # epan/wslua/CMakeLists.txt
1625 "${CMAKE_BINARY_DIR}/epan/wslua/init.lua"
1626 "${CMAKE_SOURCE_DIR}/epan/wslua/console.lua"
1627 "${CMAKE_SOURCE_DIR}/epan/wslua/dtd_gen.lua"
1629 foreach(_lua_file ${_lua_files})
1630 get_filename_component(_lua_filename "${_lua_file}" NAME)
1631 list(APPEND copy_data_files_depends
1632 "${DATAFILE_DIR}/${_lua_filename}")
1633 add_custom_command(OUTPUT "${DATAFILE_DIR}/${_lua_filename}"
1634 COMMAND ${CMAKE_COMMAND} -E copy
1636 "${DATAFILE_DIR}/${_lua_filename}"
1643 # doc/*.html handled elsewhere.
1645 # TODO shouldn't this use full (relative) paths instead of glob patterns?
1646 list(APPEND DATA_FILES_SRC
1649 "radius/README.radius_dictionary"
1650 "radius/custom.includes"
1652 "radius/dictionary.*"
1662 # Copy all paths from the source tree to the data directory. Directories are
1663 # automatically created if missing as the filename is given.
1664 file(GLOB _data_files RELATIVE "${CMAKE_SOURCE_DIR}" ${DATA_FILES_SRC})
1665 foreach(_data_file ${_data_files})
1666 add_custom_command(OUTPUT "${DATAFILE_DIR}/${_data_file}"
1667 COMMAND ${CMAKE_COMMAND} -E copy
1668 "${CMAKE_SOURCE_DIR}/${_data_file}"
1669 "${DATAFILE_DIR}/${_data_file}"
1671 "${CMAKE_SOURCE_DIR}/${_data_file}"
1673 list(APPEND copy_data_files_depends "${DATAFILE_DIR}/${_data_file}")
1676 # Copy files including ${INSTALL_FILES} and ${INSTALL_DIRS} to ${DATAFILE_DIR}
1677 add_custom_target(copy_data_files ALL DEPENDS ${copy_data_files_depends})
1678 set_target_properties(copy_data_files PROPERTIES FOLDER "Copy Tasks")
1680 if( (BUILD_wireshark AND QT_FOUND) OR (BUILD_wireshark_gtk AND GTK_FOUND) )
1693 ${CMAKE_BINARY_DIR}/image/wireshark.rc
1694 ${PLATFORM_UI_RC_FILES}
1698 if(ENABLE_APPLICATION_BUNDLE)
1700 # Add -Wl,-single_module to the LDFLAGS used with shared
1701 # libraries, to fix some error that show up in some cases;
1702 # some Apple documentation recommends it for most shared
1705 set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-single_module ${CMAKE_SHARED_LINKER_FLAGS}" )
1707 # Add -Wl,-headerpad_max_install_names to the LDFLAGS, as
1708 # code-signing issues is running out of padding space.
1710 # Add -Wl,-search_paths_first to make sure that if we search
1711 # directories A and B, in that order, for a given library, a
1712 # non-shared version in directory A, rather than a shared
1713 # version in directory B, is chosen (so we can use
1714 # --with-pcap=/usr/local to force all programs to be linked
1715 # with a static version installed in /usr/local/lib rather than
1716 # the system version in /usr/lib).
1719 set(CMAKE_EXE_LINKER_FLAGS
1720 "-Wl,-headerpad_max_install_names -Wl,-search_paths_first ${CMAKE_EXE_LINKER_FLAGS}"
1723 # Add files to the app bundle
1724 # Wireshark.app/Contents
1725 file(WRITE ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo "APPLWshk\n")
1726 set(BUNDLE_CONTENTS_FILES
1727 ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo
1729 set_source_files_properties(${BUNDLE_CONTENTS_FILES} PROPERTIES
1730 MACOSX_PACKAGE_LOCATION .
1733 # Wireshark.app/Contents/Resources
1734 set(BUNDLE_RESOURCE_FILES
1735 ${CMAKE_SOURCE_DIR}/packaging/macosx/Resources/Wireshark.icns
1736 ${CMAKE_SOURCE_DIR}/packaging/macosx/Resources/Wiresharkdoc.icns
1738 set_source_files_properties(${BUNDLE_RESOURCE_FILES} PROPERTIES
1739 MACOSX_PACKAGE_LOCATION Resources
1742 # Wireshark.app/Contents/Resources/share/man/man1
1743 set(BUNDLE_RESOURCE_SHARE_MAN1_FILES ${MAN1_FILES})
1744 set_source_files_properties(${BUNDLE_RESOURCE_SHARE_MAN1_FILES} PROPERTIES
1745 MACOSX_PACKAGE_LOCATION Resources/share/man/man1
1748 # Wireshark.app/Contents/Resources/share/man/man1
1749 set(BUNDLE_RESOURCE_SHARE_MAN4_FILES ${MAN4_FILES})
1750 set_source_files_properties(${BUNDLE_RESOURCE_SHARE_MAN4_FILES} PROPERTIES
1751 MACOSX_PACKAGE_LOCATION Resources/share/man/man4
1754 # INSTALL_FILES and INSTALL_DIRS are handled by copy_data_files
1756 set(EXTRA_BUNDLE_FILES
1757 ${BUNDLE_CONTENTS_FILES}
1758 ${BUNDLE_RESOURCE_FILES}
1759 ${BUNDLE_RESOURCE_SHARE_MAN1_FILES}
1760 ${BUNDLE_RESOURCE_SHARE_MAN4_FILES}
1763 set(EXTRA_BUNDLE_FILES)
1766 if(BUILD_wireshark AND QT_FOUND)
1773 ${GTHREAD2_LIBRARIES}
1776 ${APPLE_APPLICATION_SERVICES_LIBRARY}
1777 ${APPLE_CORE_FOUNDATION_LIBRARY}
1778 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
1782 # Policy since 2.8.11
1784 cmake_policy(SET CMP0020 NEW)
1787 add_executable(wireshark WIN32 MACOSX_BUNDLE wireshark-qt.cpp ${wireshark_FILES} ${EXTRA_BUNDLE_FILES})
1788 set(PROGLIST ${PROGLIST} wireshark)
1789 set_target_properties(wireshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1790 set_target_properties(wireshark PROPERTIES FOLDER "Executables")
1791 if(ENABLE_APPLICATION_BUNDLE OR WIN32)
1792 set_target_properties(wireshark PROPERTIES OUTPUT_NAME Wireshark)
1795 if(ENABLE_APPLICATION_BUNDLE)
1796 set_target_properties(
1797 wireshark PROPERTIES
1798 MACOSX_BUNDLE_INFO_PLIST ${CMAKE_BINARY_DIR}/packaging/macosx/Info.plist
1800 # Add a wrapper script which opens the bundle. This adds
1801 # convenience but makes debugging more difficult.
1802 file(REMOVE ${CMAKE_BINARY_DIR}/run/wireshark)
1803 file(WRITE ${CMAKE_BINARY_DIR}/run/wireshark "#!/bin/sh\n")
1804 file(APPEND ${CMAKE_BINARY_DIR}/run/wireshark "open ${CMAKE_BINARY_DIR}/run/Wireshark.app --args \"\$\@\"\n")
1805 execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/wireshark)
1808 target_link_libraries(wireshark ${wireshark_LIBS})
1811 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1812 BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
1815 if(NOT ENABLE_APPLICATION_BUNDLE)
1816 # Map for endpoints dialog
1820 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1821 "${PROJECT_SOURCE_DIR}/ipmap.html"
1822 $<TARGET_FILE_DIR:wireshark>
1826 if(WIN32 AND Qt5Core_FOUND)
1827 # Use windeployqt to copy our required DLLs to the run path.
1828 # Ideally one of the modules in ${QTDIR}/lib/cmake would expose
1829 # the path to windeployqt. For that matter having a reliable
1830 # path to qmake would be *amazingly convenient*. We don't have
1831 # either of those so we try to discover the path via Qt5Core.
1832 # http://stackoverflow.com/questions/24650936/qt5-with-cmake-how-to-find-qt-translations-dir
1834 get_target_property(_qmake_location Qt5::qmake IMPORTED_LOCATION)
1835 get_filename_component(_qt_bin_path "${_qmake_location}" DIRECTORY)
1836 find_program(QT_WINDEPLOYQT_EXECUTABLE windeployqt
1837 HINTS "${_qmake_location}"
1838 DOC "Path to the windeployqt utility."
1840 if (NOT "${QT_WINDEPLOYQT_EXECUTABLE}" STREQUAL "QT_WINDEPLOYQT_EXECUTABLE-NOTFOUND")
1841 set(QT_BIN_PATH "${_qt_bin_path}" CACHE INTERNAL
1842 "Path to qmake, windeployqt, and other Qt utilities."
1844 add_custom_target(copy_qt_dlls ALL)
1845 set_target_properties(copy_qt_dlls PROPERTIES FOLDER "Copy Tasks")
1846 # Will we ever need to use --debug? Windeployqt seems to
1847 # be smart enough to copy debug DLLs when needed.
1848 add_custom_command(TARGET copy_qt_dlls
1850 COMMAND set "PATH=%PATH%;${QT_BIN_PATH}"
1851 COMMAND "${QT_WINDEPLOYQT_EXECUTABLE}"
1852 $<$<CONFIG:Debug>:--debug>
1853 $<$<NOT:$<CONFIG:Debug>>:--release>
1854 --no-compiler-runtime
1856 "$<TARGET_FILE:wireshark>"
1858 add_dependencies(copy_qt_dlls wireshark)
1860 endif(WIN32 AND Qt5Core_FOUND)
1863 # Common properties for CLI executables
1864 macro(set_extra_executable_properties _executable _folder)
1865 set_target_properties(${_executable} PROPERTIES
1866 LINK_FLAGS "${WS_LINK_FLAGS}"
1870 set(PROGLIST ${PROGLIST} ${_executable})
1872 if(ENABLE_APPLICATION_BUNDLE)
1873 set_target_properties(${_executable} PROPERTIES
1874 RUNTIME_OUTPUT_DIRECTORY run/Wireshark.app/Contents/MacOS
1876 # Add a wrapper script which runs each executable from the
1877 # correct location. This adds convenience but makes debugging
1879 file(REMOVE ${CMAKE_BINARY_DIR}/run/${_executable})
1880 file(WRITE ${CMAKE_BINARY_DIR}/run/${_executable} "#!/bin/sh\n")
1881 file(APPEND ${CMAKE_BINARY_DIR}/run/${_executable} "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/${_executable} \"\$\@\"\n")
1882 execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/${_executable})
1886 macro(set_extcap_executable_properties _executable)
1887 set_target_properties(${_executable} PROPERTIES FOLDER "Executables/Extcaps")
1889 set(PROGLIST ${PROGLIST} ${_executable})
1892 set_target_properties(${_executable} PROPERTIES
1893 LINK_FLAGS "${WS_LINK_FLAGS}"
1894 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/extcap
1895 RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/run/Debug/extcap
1896 RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/run/Release/extcap
1897 RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_BINARY_DIR}/run/MinSizeRel/extcap
1898 RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/run/RelWithDebInfo/extcap
1901 set_target_properties(${_executable} PROPERTIES
1902 LINK_FLAGS "${WS_LINK_FLAGS}"
1903 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/extcap
1905 if(ENABLE_APPLICATION_BUNDLE)
1906 set_target_properties(${_executable} PROPERTIES
1907 RUNTIME_OUTPUT_DIRECTORY run/Wireshark.app/Contents/MacOS/extcap
1909 # Add a wrapper script which runs each executable from the
1910 # correct location. This adds convenience but makes debugging
1912 file(REMOVE ${CMAKE_BINARY_DIR}/run/${_executable})
1913 file(WRITE ${CMAKE_BINARY_DIR}/run/${_executable} "#!/bin/sh\n")
1914 file(APPEND ${CMAKE_BINARY_DIR}/run/${_executable} "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/extcap/${_executable} \"\$\@\"\n")
1915 execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/${_executable})
1920 if(BUILD_wireshark_gtk AND GTK_FOUND)
1921 set(wireshark_gtk_LIBS
1928 ${GTHREAD2_LIBRARIES}
1930 ${PORTAUDIO_LIBRARIES}
1932 ${APPLE_APPLICATION_SERVICES_LIBRARY}
1933 ${APPLE_CORE_SERVICES_LIBRARY}
1934 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
1936 ${WIN_COMCTL32_LIBRARY}
1938 # wireshark and wireshark-gtk share wireshark_FILES
1940 add_executable(wireshark-gtk WIN32 ${wireshark_FILES})
1941 set(PROGLIST ${PROGLIST} wireshark-gtk)
1942 set_target_properties(wireshark-gtk PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1943 set_target_properties(wireshark-gtk PROPERTIES FOLDER "Executables")
1944 target_link_libraries(wireshark-gtk ${wireshark_gtk_LIBS})
1945 install(TARGETS wireshark-gtk RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1947 # Map for endpoints dialog
1949 TARGET wireshark-gtk
1951 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1952 "${PROJECT_SOURCE_DIR}/ipmap.html"
1953 $<TARGET_FILE_DIR:wireshark-gtk>
1957 get_target_property(_wsgtk_location wireshark-gtk LOCATION)
1958 get_filename_component(_dll_output_dir "${_wsgtk_location}" PATH)
1959 add_custom_target(copy_gtk_dlls)
1960 set_target_properties(copy_gtk_dlls PROPERTIES FOLDER "Copy Tasks")
1961 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
1962 COMMAND ${CMAKE_COMMAND} -E make_directory "${_dll_output_dir}"
1966 set(_gtk_dll_dir "${GTK2_DLL_DIR}")
1967 set(_gtk_etc_dir "${GTK2_ETC_DIR}")
1968 set(_gtk_dlls "${GTK2_DLLS}")
1969 set(_gtk_etc_dir "${GTK2_ETC_DIR}")
1971 set(_gtk_dll_dir "${GTK3_DLL_DIR}")
1972 set(_gtk_dlls "${GTK3_DLLS}")
1973 set(_gtk_etc_dir "${GTK3_ETC_DIR}")
1976 foreach(_dll ${_gtk_dlls})
1977 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
1978 COMMAND ${CMAKE_COMMAND} -E copy_if_different
1979 "${_gtk_dll_dir}/${_dll}" "${_dll_output_dir}"
1984 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
1985 COMMAND ${CMAKE_COMMAND} -E make_directory "${_dll_output_dir}/etc"
1987 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
1988 COMMAND ${CMAKE_COMMAND} -E copy_directory
1989 "${_gtk_etc_dir}" "${_dll_output_dir}/etc"
1992 # XXX - Omitting ${GTK2_LIB_DIR}\loaders copying from Makefile.nmake
1995 set (_engines_output_dir "${_dll_output_dir}/lib/gtk-2.0/2.10.0/engines")
1996 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
1997 COMMAND ${CMAKE_COMMAND} -E make_directory "${_engines_output_dir}"
1999 foreach(_dll ${GTK2_ENGINES_DLLS})
2000 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2001 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2002 "${GTK2_ENGINES_DLL_DIR}/${_dll}" "${_engines_output_dir}"
2007 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2008 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2009 "${GTK2_THEMES_DIR}/gtkrc" "${_dll_output_dir}/etc/gtk-2.0"
2013 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2014 COMMAND ${CMAKE_COMMAND} -E copy_directory
2015 "${GTK2_LIB_DIR}" "${_dll_output_dir}/lib/gtk-2.0"
2018 add_custom_command(TARGET copy_gtk_dlls PRE_BUILD
2019 COMMAND ${CMAKE_COMMAND} -E copy_directory
2020 "${CMAKE_SOURCE_DIR}/ui/win32/settings.ini" "${_dll_output_dir}/etc"
2024 add_dependencies(wireshark-gtk copy_gtk_dlls copy_cli_dlls)
2028 register_tap_files(tshark-tap-register.c
2039 ${APPLE_CORE_FOUNDATION_LIBRARY}
2040 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
2044 tshark-tap-register.c
2048 ${CMAKE_BINARY_DIR}/image/tshark.rc
2050 add_executable(tshark ${tshark_FILES})
2051 set_extra_executable_properties(tshark "Executables")
2052 target_link_libraries(tshark ${tshark_LIBS})
2053 install(TARGETS tshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2060 ${APPLE_CORE_FOUNDATION_LIBRARY}
2061 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
2067 ${CMAKE_BINARY_DIR}/image/tfshark.rc
2069 add_executable(tfshark ${tfshark_FILES})
2070 set_extra_executable_properties(tfshark "Executables")
2071 target_link_libraries(tfshark ${tfshark_LIBS})
2072 install(TARGETS tfshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2075 if(BUILD_rawshark AND PCAP_FOUND)
2079 ${APPLE_CORE_FOUNDATION_LIBRARY}
2080 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
2086 ${CMAKE_BINARY_DIR}/image/rawshark.rc
2088 add_executable(rawshark ${rawshark_FILES})
2089 set_extra_executable_properties(rawshark "Executables")
2090 target_link_libraries(rawshark ${rawshark_LIBS})
2091 install(TARGETS rawshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2102 add_executable(dftest ${dftest_FILES})
2103 set_extra_executable_properties(dftest "Tests")
2104 target_link_libraries(dftest ${dftest_LIBS})
2105 install(TARGETS dftest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2124 add_executable(randpkt ${randpkt_FILES})
2125 set_extra_executable_properties(randpkt "Executables")
2126 target_link_libraries(randpkt ${randpkt_LIBS})
2127 install(TARGETS randpkt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2136 set(text2pcap_CLEAN_FILES
2141 ${text2pcap_CLEAN_FILES}
2142 ${CMAKE_BINARY_DIR}/image/text2pcap.rc
2144 add_lex_files(text2pcap_FILES
2147 add_executable(text2pcap ${text2pcap_FILES})
2148 set_extra_executable_properties(text2pcap "Executables")
2149 target_link_libraries(text2pcap ${text2pcap_LIBS})
2150 install(TARGETS text2pcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2161 ${CMAKE_BINARY_DIR}/image/mergecap.rc
2163 add_executable(mergecap ${mergecap_FILES})
2164 set_extra_executable_properties(mergecap "Executables")
2165 target_link_libraries(mergecap ${mergecap_LIBS})
2166 install(TARGETS mergecap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2169 if(BUILD_reordercap)
2175 set(reordercap_FILES
2177 ${CMAKE_BINARY_DIR}/image/reordercap.rc
2179 add_executable(reordercap ${reordercap_FILES})
2180 set_extra_executable_properties(reordercap "Executables")
2181 target_link_libraries(reordercap ${reordercap_LIBS})
2182 install(TARGETS reordercap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2195 ${CMAKE_BINARY_DIR}/image/capinfos.rc
2197 add_executable(capinfos ${capinfos_FILES})
2198 set_extra_executable_properties(capinfos "Executables")
2199 target_link_libraries(capinfos ${capinfos_LIBS})
2200 install(TARGETS capinfos RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2212 ${CMAKE_BINARY_DIR}/image/captype.rc
2214 add_executable(captype ${captype_FILES})
2215 set_extra_executable_properties(captype "Executables")
2216 target_link_libraries(captype ${captype_LIBS})
2217 install(TARGETS captype RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2228 ${CMAKE_BINARY_DIR}/image/editcap.rc
2230 add_executable(editcap ${editcap_FILES})
2231 set_extra_executable_properties(editcap "Executables")
2232 target_link_libraries(editcap ${editcap_LIBS})
2233 install(TARGETS editcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2236 if(BUILD_dumpcap AND PCAP_FOUND)
2245 ${GTHREAD2_LIBRARIES}
2247 ${APPLE_CORE_FOUNDATION_LIBRARY}
2248 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
2253 capture_stop_conditions.c
2259 ${CMAKE_BINARY_DIR}/image/dumpcap.rc
2261 add_executable(dumpcap ${dumpcap_FILES})
2262 set_extra_executable_properties(dumpcap "Executables")
2263 target_link_libraries(dumpcap ${dumpcap_LIBS})
2264 install(TARGETS dumpcap
2265 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
2266 PERMISSIONS ${DUMPCAP_SETUID}
2267 OWNER_READ OWNER_WRITE OWNER_EXECUTE
2268 GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
2270 if(DUMPCAP_INSTALL_OPTION STREQUAL "capabilities")
2271 install( CODE "execute_process(
2273 ${SETCAP_EXECUTABLE}
2274 cap_net_raw,cap_net_admin+ep
2275 ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/dumpcap${CMAKE_EXECUTABLE_SUFFIX}
2279 if( _SETCAP_RESULT )
2280 message( WARNING \"setcap failed (${_SETCAP_RESULT}).\")
2287 find_package( MSVC_REDIST )
2289 # Must come after executable targets are defined.
2290 find_package( NSIS )
2292 if (NOT "${MAKENSIS_EXECUTABLE}" STREQUAL "MAKENSIS_EXECUTABLE-NOTFOUND")
2293 add_subdirectory( packaging/nsis EXCLUDE_FROM_ALL )
2294 ADD_NSIS_UNINSTALLER_TARGET()
2295 ADD_NSIS_PACKAGE_TARGET()
2298 find_package( PortableApps )
2300 NOT "${PORTABLEAPPS_LAUNCHER_GENERATOR_EXECUTABLE}" STREQUAL "PORTABLEAPPS_LAUNCHER_GENERATOR_EXECUTABLE-NOTFOUND"
2302 NOT "${PORTABLEAPPS_INSTALLER_EXECUTABLE}" STREQUAL "PORTABLEAPPS_INSTALLER_EXECUTABLE-NOTFOUND"
2304 add_subdirectory( packaging/portableapps EXCLUDE_FROM_ALL )
2305 ADD_PORTABLEAPPS_PACKAGE_TARGET()
2309 if(BUILD_androiddump)
2310 if(EXTCAP_ANDROIDDUMP_LIBPCAP)
2312 set(androiddump_LIBS
2317 message(FATAL_ERROR "You try to build androiddump with libpcap but do not have it")
2320 set(androiddump_LIBS
2326 set(androiddump_FILES
2327 extcap/androiddump.c
2330 add_executable(androiddump WIN32 ${androiddump_FILES})
2331 # XXX Shouldn't we add wsutil to androiddump_LIBS instead?
2332 set_extcap_executable_properties(androiddump)
2333 target_link_libraries(androiddump ${androiddump_LIBS})
2334 install(TARGETS androiddump RUNTIME DESTINATION ${EXTCAP_DIR})
2337 if(BUILD_sshdump AND LIBSSH_FOUND)
2344 set(sshdump_LIBS wsutil ${sshdump_LIBS})
2350 add_executable(sshdump WIN32 ${sshdump_FILES})
2351 set_extcap_executable_properties(sshdump)
2352 target_link_libraries(sshdump ${sshdump_LIBS})
2353 target_include_directories(sshdump PUBLIC ${LIBSSH_INCLUDE_DIR})
2354 install(TARGETS sshdump RUNTIME DESTINATION ${EXTCAP_DIR})
2355 elseif (BUILD_sshdump)
2356 #message( WARNING "Cannot find libssh, cannot build sshdump" )
2360 OUTPUT ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2361 COMMAND ${PERL_EXECUTABLE}
2362 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
2363 ${CMAKE_SOURCE_DIR}/doc/make-authors-short.pl
2364 < ${CMAKE_SOURCE_DIR}/AUTHORS
2365 > ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2367 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
2368 ${CMAKE_SOURCE_DIR}/doc/make-authors-short.pl
2369 ${CMAKE_SOURCE_DIR}/AUTHORS
2373 OUTPUT ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2374 COMMAND ${PERL_EXECUTABLE}
2375 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
2376 ${CMAKE_SOURCE_DIR}/doc/make-authors-format.pl
2377 < ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2378 > ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2380 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
2381 ${CMAKE_SOURCE_DIR}/doc/make-authors-format.pl
2382 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2386 FILE(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template WPT_WIN_PATH)
2387 FILE(TO_NATIVE_PATH ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT ASF_WIN_PATH)
2388 FILE(TO_NATIVE_PATH ${CMAKE_BINARY_DIR}/wireshark.pod WP_WIN_PATH)
2390 OUTPUT ${CMAKE_BINARY_DIR}/wireshark.pod
2391 COMMAND copy /B ${WPT_WIN_PATH} + ${ASF_WIN_PATH} ${WP_WIN_PATH}
2393 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
2394 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2399 OUTPUT ${CMAKE_BINARY_DIR}/wireshark.pod
2401 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
2402 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2403 > ${CMAKE_BINARY_DIR}/wireshark.pod
2405 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
2406 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
2410 if(ENABLE_APPLICATION_BUNDLE)
2411 add_custom_target(app_bundle)
2412 set_target_properties(app_bundle PROPERTIES FOLDER "Copy Tasks")
2413 add_custom_command(TARGET app_bundle
2415 COMMAND "${CMAKE_SOURCE_DIR}/packaging/macosx/osx-app.sh"
2416 WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/run"
2418 add_dependencies(app_bundle ${PROGLIST})
2420 add_custom_target(dmg_package_prep DEPENDS app_bundle)
2423 OUTPUT ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo
2424 COMMAND ${CMAKE_COMMAND} -E echo APPLWshk > ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo
2427 ADD_CUSTOM_TARGET( dmg_package
2428 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2429 "${PROJECT_SOURCE_DIR}/ipmap.html"
2430 $<TARGET_FILE_DIR:wireshark>
2431 COMMAND ${CMAKE_COMMAND} -E copy_directory
2432 ${CMAKE_SOURCE_DIR}/packaging/macosx/ChmodBPF
2433 ${CMAKE_BINARY_DIR}/run/ChmodBPF
2434 COMMAND ${CMAKE_COMMAND} -E copy_directory
2435 ${CMAKE_SOURCE_DIR}/packaging/macosx/Resources
2436 ${CMAKE_BINARY_DIR}/run/Resources
2437 COMMAND ${CMAKE_COMMAND} -E copy_directory
2438 ${CMAKE_SOURCE_DIR}/packaging/macosx/Scripts
2439 ${CMAKE_BINARY_DIR}/run/Scripts
2440 COMMAND ${CMAKE_COMMAND} -E copy_directory
2441 ${CMAKE_SOURCE_DIR}/packaging/macosx/utility-launcher
2442 ${CMAKE_BINARY_DIR}/run/utility-launcher
2443 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2444 ${CMAKE_SOURCE_DIR}/COPYING
2445 ${CMAKE_BINARY_DIR}/run/COPYING.txt
2446 COMMAND ${CMAKE_COMMAND} -E copy_directory
2447 ${CMAKE_SOURCE_DIR}/packaging/macosx/Wireshark_package.pmdoc
2448 ${CMAKE_BINARY_DIR}/run/Wireshark_package.pmdoc
2449 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2450 ${CMAKE_BINARY_DIR}/packaging/macosx/Wireshark_package.pmdoc/index.xml
2451 ${CMAKE_BINARY_DIR}/run/Wireshark_package.pmdoc/index.xml
2452 COMMAND ${CMAKE_COMMAND} -E copy_if_different
2453 ${CMAKE_SOURCE_DIR}/packaging/macosx/dmg_background.png
2454 ${CMAKE_BINARY_DIR}/run/dmg_background.png
2455 COMMAND bash -x ${CMAKE_BINARY_DIR}/packaging/macosx/osx-dmg.sh
2456 --source-directory ${CMAKE_SOURCE_DIR}/packaging/macosx
2457 # Unlike nsis_package_prep + nsis_package, we can add a direct
2459 DEPENDS dmg_package_prep
2460 # We create Wireshark.app in "run". Do our work there.
2461 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/run
2466 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/androiddump 1 )
2467 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/capinfos 1 )
2468 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/captype 1 )
2469 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dftest 1 )
2470 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dumpcap 1 )
2471 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/editcap 1 )
2472 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/extcap 4 )
2473 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/asn2deb 1 )
2474 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2deb 1 )
2475 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2wrs 1 )
2476 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/mergecap 1 )
2477 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/randpkt 1 )
2478 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/rawshark 1 )
2479 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/reordercap 1 )
2480 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/sshdump 1 )
2481 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/text2pcap 1 )
2482 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/tshark 1 )
2483 pod2manhtml( ${CMAKE_BINARY_DIR}/wireshark 1 )
2484 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/wireshark-filter 4 )
2489 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
2507 wireshark-filter.html
2509 set_target_properties(html_docs PROPERTIES FOLDER "Docs")
2517 ${text2pcap_CLEAN_FILES}
2523 ${androiddump_FILES}
2527 if (WERROR_COMMON_FLAGS)
2528 set_source_files_properties(
2531 COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
2539 ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
2546 ${CMAKE_INSTALL_MANDIR}/man1
2553 ${CMAKE_INSTALL_MANDIR}/man4
2558 "${CMAKE_BINARY_DIR}/wireshark.pc"
2560 ${CMAKE_INSTALL_LIBDIR}/pkgconfig
2566 DIRECTORY_PERMISSIONS
2567 OWNER_EXECUTE OWNER_WRITE OWNER_READ
2568 GROUP_EXECUTE GROUP_READ
2569 WORLD_EXECUTE WORLD_READ
2571 ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
2572 PATTERN ".git" EXCLUDE
2573 PATTERN ".svn" EXCLUDE
2574 PATTERN "Makefile.*" EXCLUDE
2575 PATTERN "faq.py" EXCLUDE
2578 include( UseCheckAPI )
2584 set(CMAKE_INSTALL_MODULES_DIR ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME})
2585 configure_file("${CMAKE_MODULE_PATH}/WiresharkConfig.cmake.in" "${CMAKE_BINARY_DIR}/WiresharkConfig.cmake" @ONLY)
2586 configure_file("${CMAKE_MODULE_PATH}/WiresharkConfigVersion.cmake.in" "${CMAKE_BINARY_DIR}/WiresharkConfigVersion.cmake" @ONLY)
2589 ${CMAKE_MODULE_PATH}/FindGLIB2.cmake
2590 ${CMAKE_MODULE_PATH}/FindWireshark.cmake
2591 ${CMAKE_MODULE_PATH}/FindWSWinLibs.cmake
2592 ${CMAKE_MODULE_PATH}/UseAsn2Wrs.cmake
2593 ${CMAKE_MODULE_PATH}/LocatePythonModule.cmake
2594 ${CMAKE_MODULE_PATH}/UseMakeDissectorReg.cmake
2595 ${CMAKE_BINARY_DIR}/WiresharkConfig.cmake
2596 ${CMAKE_BINARY_DIR}/WiresharkConfigVersion.cmake
2598 ${CMAKE_INSTALL_MODULES_DIR}
2602 message(STATUS "Docdir install: ${DOC_DIR}")
2605 ${CMAKE_BINARY_DIR}/docbook/
2606 DIRECTORY_PERMISSIONS
2607 OWNER_EXECUTE OWNER_WRITE OWNER_READ
2608 GROUP_EXECUTE GROUP_READ
2609 WORLD_EXECUTE WORLD_READ
2617 # Test suite wrapper
2618 if(ENABLE_APPLICATION_BUNDLE)
2619 set(TEST_SH_BIN_DIR ${CMAKE_BINARY_DIR}/run)
2621 set(TEST_SH_BIN_DIR $<TARGET_FILE_DIR:epan>)
2624 add_custom_target(test-sh
2625 COMMAND ${CMAKE_COMMAND}
2626 -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
2627 -DTEST_SH_BIN_DIR=${TEST_SH_BIN_DIR}
2628 -DTEST_SH_SRC_DIR=${CMAKE_SOURCE_DIR}/test
2629 -P ${CMAKE_SOURCE_DIR}/cmake/modules/GenerateTestSh.cmake
2630 DEPENDS ${CMAKE_SOURCE_DIR}/cmake/modules/GenerateTestSh.cmake
2632 set_target_properties(test-sh PROPERTIES FOLDER "Tests")
2634 add_custom_target(test-programs
2641 COMMENT "Building unit test programs and wrapper"
2643 set_target_properties(test-programs PROPERTIES FOLDER "Tests")
2646 file (TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/tools/Get-HardenFlags.ps1 _win_harden_flags)
2647 add_custom_target(hardening-check
2648 COMMAND ${POWERSHELL_COMMAND} "${_win_harden_flags}" "${_dll_output_dir_win}"
2650 COMMENT "Checking binaries for security features"
2652 set_target_properties(hardening-check PROPERTIES FOLDER "Tests")
2654 find_program(HARDENING_CHECK_EXECUTABLE hardening-check
2655 DOC "Path to the hardening-check utility."
2657 if (NOT "${HARDENING_CHECK_EXECUTABLE}" STREQUAL "HARDENING_CHECK_EXECUTABLE-NOTFOUND")
2658 foreach(_prog ${PROGLIST})
2659 get_target_property(_prog_dir ${_prog} RUNTIME_OUTPUT_DIRECTORY)
2660 if ("${_prog_dir}" STREQUAL "_prog_dir-NOTFOUND")
2661 set(_prog_dir "${CMAKE_BINARY_DIR}/run")
2663 set(_prog_paths ${_prog_paths} "${_prog_dir}/${_prog}")
2665 add_custom_target(hardening-check
2666 COMMAND ${HARDENING_CHECK_EXECUTABLE} ${_prog_paths}
2668 COMMENT "Checking binaries for security features"
2674 # Editor modelines - http://www.wireshark.org/tools/modelines.html
2679 # indent-tabs-mode: t
2682 # vi: set shiftwidth=8 tabstop=8 noexpandtab:
2683 # :indentSize=8:tabSize=8:noTabs=false: