sec_vt_header: dissect drep
[wireshark-wip.git] / CMakeLists.txt
blobafbcbf2efd1603e8f8a5edd1833fd1e6c8835865
1 # CMakeLists.txt
3 # $Id$
5 # Wireshark - Network traffic analyzer
6 # By Gerald Combs <gerald@wireshark.org>
7 # Copyright 1998 Gerald Combs
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License
11 # as published by the Free Software Foundation; either version 2
12 # of the License, or (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 project(Wireshark C CXX)
26 cmake_minimum_required(VERSION 2.6)
27 set(CMAKE_BACKWARDS_COMPATIBILITY 2.6)
29 # Needs to be set after cmake_minimum_required or cmake_policy(VERSION)
30 # Policy since 2.6.1
31 cmake_policy(SET CMP0008 NEW)
32 # Policy since 2.6.3
33 # Backward compatibility for versions < 2.6.3
34 cmake_policy(SET CMP0011 OLD)
35 # Policy since 2.8.1
36 #cmake_policy(SET CMP0015 NEW)
37 # Policy since 2.8.11
38 if( ${CMAKE_MAJOR_VERSION} GREATER 2 OR
39     ${CMAKE_MINOR_VERSION} GREATER 8 OR
40     (${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 10) )
41         # Don't: Automatically link Qt executable to qtmain target on Windows
42         cmake_policy(SET CMP0020 OLD)
43 endif()
45 # This cannot be implemented via option(...)
46 if( NOT CMAKE_BUILD_TYPE )
47   set( CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
48       "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
49       FORCE)
50 endif()
51 message(STATUS "Configuration types: ${CMAKE_CONFIGURATION_TYPES}")
52 message(STATUS "${CMAKE_BUILD_TYPE}: ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
54 # set(PROJECT_MAJOR_VERSION 1)
55 # set(PROJECT_MINOR_VERSION 9)
56 # set(PROJECT_PATCH_VERSION 0)
57 # set(PROJECT_VERSION_EXTENSION "-rc5")
58 # If not set, copy over Wireshark version from configure.ac
59 if(NOT PROJECT_MAJOR_VERSION)
60         file(STRINGS
61                 ${CMAKE_SOURCE_DIR}/configure.ac
62                 PROJECT_MAJOR_VERSION_TMP
63                 REGEX "^m4_define\\(\\[?version_major\\]?, *\\[?[0-9]+\\]?\\)"
64         )
65         file(STRINGS
66                 ${CMAKE_SOURCE_DIR}/configure.ac
67                 PROJECT_MINOR_VERSION_TMP
68                 REGEX "^m4_define\\(\\[?version_minor\\]?, *\\[?[0-9]+\\]?\\)"
69         )
70         file(STRINGS
71                 ${CMAKE_SOURCE_DIR}/configure.ac
72                 PROJECT_PATCH_VERSION_TMP
73                 REGEX "^m4_define\\(\\[?version_micro\\]?, *\\[?[0-9]+\\]?\\)"
74         )
75         # XXX pull VERSION_EXTENSION out of configure.ac ?
77         string(REGEX REPLACE "m4_define\\(\\[?version_major\\]?, *\\[?([0-9]+)\\]?\\)"
78                 "\\1"
79                 PROJECT_MAJOR_VERSION
80                 ${PROJECT_MAJOR_VERSION_TMP}
81         )
82         string(REGEX REPLACE "m4_define\\(\\[?version_minor\\]?, *\\[?([0-9]+)\\]?\\)"
83                 "\\1"
84                 PROJECT_MINOR_VERSION
85                 ${PROJECT_MINOR_VERSION_TMP}
86         )
87         string(REGEX REPLACE "m4_define\\(\\[?version_micro\\]?, *\\[?([0-9]+)\\]?\\)"
88                 "\\1"
89                 PROJECT_PATCH_VERSION
90                 ${PROJECT_PATCH_VERSION_TMP}
91         )
92 endif()
95 if(PROJECT_VERSION_EXTENSION)
96         set(PROJECT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}${PROJECT_VERSION_EXTENSION})
97 else()
98         set(PROJECT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION})
99 endif()
101 message(STATUS "V: ${PROJECT_VERSION}, MaV: ${PROJECT_MAJOR_VERSION}, MiV: ${PROJECT_MINOR_VERSION}, PL: ${PROJECT_PATCH_VERSION}, EV: ${PROJECT_VERSION_EXTENSION}.")
103 #Where to find local cmake scripts
104 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
105 INCLUDE(UseLemon)
106 INCLUDE(UseMakeDissectorReg)
107 INCLUDE(UseMakeTapReg)
108 INCLUDE(UseAsn2Wrs)
110 # Under linux the release mode (CMAKE_BUILD_TYPE=release) defines NDEBUG
112 # Enable with: "make VERBOSE=1"
113 set(CMAKE_VERBOSE_MAKEFILE OFF)
115 #Defines CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_DATADIR, etc ...
116 include(CMakeInstallDirs)
118 include_directories(
119         ${CMAKE_BINARY_DIR}
120         ${CMAKE_SOURCE_DIR}
121         ${CMAKE_SOURCE_DIR}/epan
122         ${CMAKE_SOURCE_DIR}/tools/lemon
123         ${CMAKE_SOURCE_DIR}/wiretap
126 #Where to put libraries
127 if(NOT LIBRARY_OUTPUT_PATH)
128         set(LIBRARY_OUTPUT_PATH ${Wireshark_BINARY_DIR}/lib CACHE INTERNAL
129                    "Single output directory for building all libraries.")
130 endif()
133 include(CMakeOptions.txt)
135 if( CMAKE_C_COMPILER_ID MATCHES "MSVC")
136     set(LOCAL_CFLAGS
137         /Zi
138         /W3
139         /MDd
140         /DWIN32_LEAN_AND_MEAN
141         "/DMSC_VER_REQUIRED=${MSC_VER_REQUIRED}"
142         /D_CRT_SECURE_NO_DEPRECATE
143         /D_CRT_NONSTDC_NO_DEPRECATE
144         /MP
145         # NOMINMAX keeps windows.h from defining "min" and "max" via windef.h.
146         # This avoids conflicts with the C++ standard library.
147         /DNOMINMAX
148     )
150     if(NOT WIN64)
151         set(LOCAL_CFLAGS ${LOCAL_CFLAGS} "/D_BIND_TO_CURRENT_CRT_VERSION=1")
152     endif()
154     # Additional compiler warnings to be treated as "Level 3"
155     #  when compiling Wireshark sources. (Selected from "level 4" warnings).
156     ## 4295: array is too small to include a terminating null character
157     set(WARNINGS_CFLAGS "/w34295")
159     set(WIRESHARK_C_FLAGS
160         # FIXME: This doen't work as PCAP_VERSION will be determined later
161         "/DPCAP_VERSION=${PCAP_VERSION}"
162         ${LOCAL_CFLAGS}
163         ${WARNINGS_CFLAGS}
164     )
165 else()
166     set(WIRESHARK_C_FLAGS
167         # -O<X> and -g get set by the CMAKE_BUILD_TYPE
168         -Wall
169         -W
170         -Wextra
171         -Wendif-labels
172         -Wpointer-arith
173         -Warray-bounds
174         -Wformat-security
175         -Wshorten-64-to-32
176         -Wvla
177         -Waddress
178         -Warray-bounds
179         -Wattributes
180         -Wdiv-by-zero
181         -Wignored-qualifiers
182         -Wno-overlength-strings
183         -Wwrite-strings
184         -Wno-long-long
185         -Wpragmas
186     )
188     set(WIRESHARK_C_ONLY_FLAGS
189         # The following are C only, not C++
190         -Wc++-compat
191         -Wdeclaration-after-statement
192         -Wshadow
193         -Wno-pointer-sign
194         -Wold-style-definition
195         -Wstrict-prototypes
196         -Wlogical-op
197         -Wjump-misses-init
198     )
200     set(WIRESHARK_EXTRA_C_FLAGS
201         -pedantic
202         -Woverflow
203         -fstrict-overflow -Wstrict-overflow=4
204         -Wunreachable-code
205         -Wunsafe-loop-optimizations
206         -Wcast-align
207         -Wcast-qual
208         -Wformat-security
209         -Wredundant-decls
210         # All the registration functions block these for now.
211         -Wmissing-declarations
212     )
214     set(WIRESHARK_EXTRA_C_ONLY_FLAGS
215         # The following are C only, not C++
216         -Wbad-function-cast
217         # All the registration functions block these for now.
218         -Wmissing-prototypes
219     )
221     # With clang some tests don't fail properly during testing but only
222     # during real compiles
224     if(CMAKE_C_COMPILER_ID MATCHES "Clang")
225         set(WIRESHARK_C_FLAGS ${WIRESHARK_C_FLAGS}
226             -Qunused-arguments
227             #-fcolor-diagnostics
228         )
229     else()
230         set(WIRESHARK_C_FLAGS ${WIRESHARK_C_FLAGS}
231             -fexcess-precision=fast
232         )
234         set(WIRESHARK_C_ONLY_FLAGS ${WIRESHARK_C_ONLY_FLAGS}
235         )
236     endif()
238     if(ENABLE_EXTRA_GCC_CHECKS)   # This overrides -Werror
239         set(WIRESHARK_C_FLAGS ${WIRESHARK_C_FLAGS} ${WIRESHARK_EXTRA_C_FLAGS})
240         set(WIRESHARK_C_ONLY_FLAGS ${WIRESHARK_C_ONLY_FLAGS} ${WIRESHARK_EXTRA_C_ONLY_FLAGS})
241     endif()
243     add_definitions(
244         -DG_DISABLE_DEPRECATED
245         -DG_DISABLE_SINGLE_INCLUDES
246     )
247 endif()
249 # Counterhack to work around some cache magic in CHECK_C_SOURCE_COMPILES
250 include(CheckCCompilerFlag)
252 if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_GCC_CHECKS)
253         check_c_compiler_flag(-Werror=unknown-warning-option WERR_UNKNOWN)
254         check_c_compiler_flag(-Werror WERROR)
255 else()
256         unset(WERR_UNKNOWN)
257         unset(WERROR)
258 endif()
259 # string of additional compile command line flags for check_c_compiler_flag
260 if(WERR_UNKNOWN)
261         set(CMAKE_REQUIRED_FLAGS -Werror=unknown-warning-option )
262 endif()
264 set(C 0)
265 # Sigh: Have to use THIS_FLAG instead of ${F} for some reason
266 foreach(THIS_FLAG ${WIRESHARK_C_FLAGS})
267         set(F WS_C_FLAG_${C})
268         set(${F} ${THIS_FLAG})
269         set(V WS_C_FLAG_VALID${C})
270         message(STATUS "Checking for flag: ${${F}}")
271         check_c_compiler_flag(${${F}} ${V})
272         if (${${V}})
273                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${${F}}")
274                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${F}}")
275         endif()
276         math(EXPR C "${C} + 1")
277 endforeach()
278 # Continue increasing C from previous loop
279 foreach(THIS_FLAG ${WIRESHARK_C_ONLY_FLAGS})
280         set(F WS_C_FLAG_${C})
281         set(${F} ${THIS_FLAG})
282         set(V WS_C_FLAG_VALID${C})
283         message(STATUS "Checking for flag: ${${F}}")
284         check_c_compiler_flag(${${F}} ${V})
285         if (${${V}})
286                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${${F}}")
287         endif()
288         math(EXPR C "${C} + 1")
289 endforeach()
290 message(STATUS "C-Flags: ${CMAKE_C_FLAGS}\nCXX-Flags: ${CMAKE_CXX_FLAGS}")
292 check_c_compiler_flag(-fvisibility=hidden FVHIDDEN)
293 if((FVHIDDEN))
294         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
295 else() # TODO add alternate compiler flags for hiding symbols
296         message(WARNING "Hiding shared library symbols is not supported by the compiler."
297                 " All shared library symbols will be exported.")
298 endif()
300 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
301         set (C_UNUSED "__attribute__((unused))" )
302 else()
303         set (C_UNUSED "" )
304 endif()
307 if( CMAKE_C_COMPILER_ID MATCHES "MSVC")
308         # Set in Makefile.nmake
309         set(WIRESHARK_LD_FLAGS
310                 /LARGEADDRESSAWARE
311         )
312 else()
313         set(WIRESHARK_LD_FLAGS
314                 -Wl,--as-needed
315                 # -flto
316                 # -fwhopr
317                 # -fwhole-program
318         )
319 endif()
321 include(CheckCLinkerFlag)
322 set(C 0)
323 # Sigh: Have to use THIS_FLAG instead of ${F} for some reason
324 foreach(THIS_FLAG ${WIRESHARK_LD_FLAGS})
325         set(F WS_LD_FLAG_${C})
326         set(${F} ${THIS_FLAG})
327         set(V WS_LD_FLAG_VALID${C})
328         check_c_linker_flag(${${F}} ${V})
329         if (${${V}})
330                 set(WS_LINK_FLAGS ${WS_LINK_FLAGS} ${${F}})
331         endif()
332         math(EXPR C "${C} + 1")
333 endforeach()
335 if(ENABLE_STATIC)
336   set(LINK_MODE_LIB STATIC)
337   set(LINK_MODE_MODULE STATIC)
338 else()
339   set(LINK_MODE_LIB SHARED)
340   set(LINK_MODE_MODULE MODULE)
341 endif()
343 if(APPLE AND EXISTS /usr/local/opt/gettext)
344         # GLib on OS X requires libintl. Homebrew installs gettext (and
345         # libintl) in /usr/local/opt/gettext
346         include_directories(/usr/local/opt/gettext/include)
347         link_directories(/usr/local/opt/gettext/lib)
348 endif()
350 # The packagelist is doing some magic:  If we add XXX to the packagelist, we
351 # - may optionally set XXX_OPTIONS to pass to the find_package command
352 # - will call FindXXX.cmake
353 # - return found libraries in XXX_LIBRARIES
354 # - return found include in XXX_INCLUDE_DIRS
355 # - set HAVE_XXX
357 #The minimum package list
358 set(PACKAGELIST Gettext GLIB2 GMODULE2 GTHREAD2 M LEX YACC Perl SED SH PythonInterp)
359 set(GLIB2_FIND_REQUIRED)
360 set(GLIB2_MIN_VERSION 2.14.0)
361 set(GTHREAD2_REQUIRED)
362 set(M_REQUIRED)
363 set(PythonInterp_FIND_VERSION 2)
364 set(Python_ADDITIONAL_VERSIONS 3)
366 set(PACKAGELIST ${PACKAGELIST} HtmlViewer)
368 if(ENABLE_PCAP)
369         set(PACKAGELIST ${PACKAGELIST} PCAP)
370 endif()
372 if(ENABLE_AIRPCAP)
373         set(PACKAGELIST ${PACKAGELIST} AIRPCAP)
374 endif()
376 # Build the GTK-GUI?
377 if(BUILD_wireshark)
378         if(ENABLE_GTK3)
379                 set(PACKAGELIST ${PACKAGELIST} GTK3)
380         else()
381                 set(PACKAGELIST ${PACKAGELIST} GTK2)
382                 set(GTK2_OPTIONS COMPONENTS gtk)
383                 set(GTK2_FIND_VERSION 2.12)
384                 set(GTK2_DEBUG false)
385         endif()
386 endif()
388 # Build the Qt GUI?
389 if(BUILD_qtshark)
390         if(ENABLE_QT5)
391                 set(PACKAGELIST ${PACKAGELIST} Qt5Widgets Qt5PrintSupport Qt5LinguistTools)
392                 if (APPLE)
393                         set(PACKAGELIST ${PACKAGELIST} Qt5MacExtras)
394                 endif()
395                 set(QT_VERSION 5)
396                 # Untested, may not work if CMAKE_PREFIX_PATH gets overwritten
397                 # somewhere. The if WIN32 in this place is annoying as well.
398                 if( WIN32 )
399                         set( QT5_BASE_PATH "$ENV{QT5_BASE_DIR}" )
400                         set( CMAKE_PREFIX_PATH "${QT5_BASE_PATH}\\msvc2010" )
401                         set( QT5_DLL_PATH "${CMAKE_PREFIX_PATH}/bin/dummy" )
402                         set( WS_ALL_LIBS ${WS_ALL_LIBS} ${QT5_DLL_PATH} )
403                 endif()
404         else()
405                 set(PACKAGELIST ${PACKAGELIST} Qt4)
406                 # set(Qt4_OPTIONS 4.7.1 REQUIRED QtCore QtGui)
407                 set(QT_VERSION 4)
408         endif()
409 endif()
411 # SMI SNMP
412 if(ENABLE_SMI)
413         set(PACKAGELIST ${PACKAGELIST} SMI)
414 endif()
416 # GNU crypto
417 if(ENABLE_GCRYPT)
418         set(PACKAGELIST ${PACKAGELIST} GCRYPT)
419 endif()
421 # GNU SSL/TLS support
422 if(ENABLE_GNUTLS)
423         set(PACKAGELIST ${PACKAGELIST} GNUTLS)
424 endif()
426 # Kerberos
427 if(ENABLE_KERBEROS)
428         set(PACKAGELIST ${PACKAGELIST} KERBEROS)
429 endif()
431 # Portable audio
432 if(ENABLE_PORTAUDIO AND BUILD_wireshark)
433         set(PACKAGELIST ${PACKAGELIST} PORTAUDIO)
434 endif()
437 # Prefer c-ares over adns
438 if(ENABLE_CARES)        # C Asynchronouse resolver
439         set(PACKAGELIST ${PACKAGELIST} CARES)
440 elseif(ENABLE_ADNS)     # Gnu asynchronous DNS
441         set(PACKAGELIST ${PACKAGELIST} ADNS)
442 endif()
444 # Zlib compression
445 if(ENABLE_ZLIB)
446         set(PACKAGELIST ${PACKAGELIST} ZLIB)
447 endif()
449 # Lua 5.1 dissectors
450 if(ENABLE_LUA)
451         set(PACKAGELIST ${PACKAGELIST} LUA)
452 endif()
454 # GeoIP address resolving
455 if(ENABLE_GEOIP)
456         set(PACKAGELIST ${PACKAGELIST} GEOIP)
457 endif()
459 if(ENABLE_NETLINK)
460         set(PACKAGELIST ${PACKAGELIST} NL)
461 endif()
463 # Capabilities
464 if(ENABLE_CAP)
465         set(PACKAGELIST ${PACKAGELIST} CAP)
466 endif()
468 if(ENABLE_PYTHON)
469         set(PACKAGELIST ${PACKAGELIST} PythonLibs)
470 endif()
472 set(PACKAGELIST ${PACKAGELIST} YAPP)
474 set(PACKAGELIST ${PACKAGELIST} POD)
476 set(PROGLIST text2pcap mergecap capinfos editcap reordercap dumpcap)
478 #Sort the package list
479 list(SORT PACKAGELIST)
480 message(STATUS "Packagelist: ${PACKAGELIST}")
481 #Let's loop the package list
482 foreach(PACKAGE ${PACKAGELIST})
483         if(${PACKAGE} STREQUAL "Qt4")
484                 set(PACKAGE_VAR "QT")
485         elseif(${PACKAGE} STREQUAL "PythonInterp")
486                 set(PACKAGE_VAR "PYTHON")
487         elseif(${PACKAGE} STREQUAL "PythonLibs")
488                 set(PACKAGE_VAR "PYTHON")
489         else()
490                 set(PACKAGE_VAR ${PACKAGE})
491         endif()
492         if(${PACKAGE}_OPTIONS)
493                 find_package(${PACKAGE} ${${PACKAGE}_OPTIONS})
494         elseif(${PACKAGE}_REQUIRED)
495                 find_package(${PACKAGE} REQUIRED)
496         else()
497                 find_package(${PACKAGE})
498         endif()
499         message(${PACKAGE_VAR}_FOUND)
500         if (${PACKAGE_VAR}_FOUND)
501                 set(HAVE_LIB${PACKAGE_VAR} 1)
502                 include_directories(${${PACKAGE_VAR}_INCLUDE_DIRS})
503                 set(WS_ALL_LIBS ${WS_ALL_LIBS} ${${PACKAGE_VAR}_LIBRARIES})
504                 message(STATUS "${PACKAGE} includes: ${${PACKAGE_VAR}_INCLUDE_DIRS}")
505                 message(STATUS "${PACKAGE} libs: ${${PACKAGE_VAR}_LIBRARIES}")
506                 if (${PACKAGE}_DEFINITIONS)
507                         message(STATUS "${PACKAGE} definitions: ${${PACKAGE_VAR}_DEFINITIONS}")
508                 endif()
509                 if (${PACKAGE_VAR}_EXECUTABLE)
510                         message(STATUS "${PACKAGE} executable: ${${PACKAGE_VAR}_EXECUTABLE}")
511                 endif()
512         endif()
513 endforeach()
515 # Provide Windows system lib names
516 include( UseWinLibs )
518 # Create file to set paths to run binaries from build dir
519 WSExtendPath( "${WS_ALL_LIBS}" "${CMAKE_BINARY_DIR}/setpath.bat" )
521 #packaging
522 include(CPackConfig.txt)
524 if(HAVE_LIBPYTHON)
525         set(HAVE_PYTHON 1)
526         set(PYTHON_DIR "${CMAKE_INSTALL_PREFIX}/lib/wireshark/python/${CPACK_PACKAGE_VERSION}")
527 endif()
528 if(HAVE_LIBLUA)
529         set(HAVE_LUA_H 1)
530         set(HAVE_LUA 1)
531 endif()
532 if(HAVE_LIBKERBEROS)
533         set(HAVE_KERBEROS 1)
534         # HAVE_HEIMDAL_KERBEROS
535         set(HAVE_MIT_KERBEROS 1)
536         set(HAVE_KEYTYPE_ARCFOUR_56 1)
537 endif()
538 if(HAVE_LIBGEOIP)
539         set(HAVE_GEOIP 1)
540 endif()
541 if(HAVE_LIBCARES)
542         set(HAVE_C_ARES 1)
543 endif()
544 if(HAVE_LIBADNS)
545         set(HAVE_GNU_ADNS 1)
546 endif()
547 if(HAVE_LIBNL AND HAVE_AIRPCAP)
548         message(ERROR "Airpcap and Libnl support are mutually exclusive")
549 endif()
550 # No matter which version of GTK is present
551 if(GTK2_FOUND OR GTK3_FOUND)
552         set(GTK_FOUND ON)
553 endif()
554 # That's the name autofoo uses
555 if(HAVE_LIBZLIB)
556         set(HAVE_LIBZ 1)
557 endif()
558 if (Qt5Widgets_FOUND)
559         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
560         if (Qt5_POSITION_INDEPENDENT_CODE)
561                 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
562         endif()
563         set (QT_FOUND ON)
564         set (QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES})
565         if(Qt5MacExtras_FOUND)
566                 set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5MacExtras_LIBRARIES})
567                 # That's the name autofoo uses
568                 set(QT_MACEXTRAS_LIB 1)
569         endif()
570 # If Qt4: QT_LIBRARIES and QT_INCLUDES are not set above. They require extra magic
571 elseif(QT_FOUND)
572         include(${QT_USE_FILE})
573         include_directories(${QT_INCLUDE_DIR})
574         message(STATUS "QT includes: ${QT_INCLUDE_DIR}")
575         message(STATUS "QT libs: ${QT_LIBRARIES}")
576 endif()
577 include(ConfigureChecks.cmake)
579 #Big or little endian ?
580 include(TestBigEndian)
581 test_big_endian(WORDS_BIGENDIAN)
583 set(DATAFILE_DIR "${CMAKE_INSTALL_PREFIX}/share/${CPACK_PACKAGE_NAME}")
585 SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
587 if(ENABLE_PLUGINS)
588         set(HAVE_PLUGINS 1)
589         set(PLUGIN_DIR="${DATAFILE_DIR}/plugins/${CPACK_PACKAGE_VERSION}")
590         set(PLUGIN_SRC_DIRS
591                 plugins/asn1
592                 plugins/docsis
593                 plugins/ethercat
594                 plugins/gryphon
595                 plugins/irda
596                 plugins/m2m
597                 plugins/mate
598                 plugins/opcua
599                 plugins/profinet
600                 plugins/stats_tree
601                 plugins/unistim
602                 plugins/wimax
603                 plugins/wimaxasncp
604                 plugins/wimaxmacphy
605         )
606 # It seems this stuff doesn't build with autofoo either...
607 #       if(YAPP_FOUND)
608 #               set(PLUGIN_SRC_DIRS
609 #                       ${PLUGIN_SRC_DIRS}
610 #                       plugins/tpg
611 #               )
612 #       endif()
613 else()
614         set(PLUGIN_SRC_DIRS )
615 endif()
617 foreach(PLUGIN_DIR ${PLUGIN_SRC_DIRS})
618         add_subdirectory( ${PLUGIN_DIR} )
619 endforeach()
621 add_subdirectory( asn1 EXCLUDE_FROM_ALL )
622 add_subdirectory( codecs )
623 add_subdirectory( epan )
624 add_subdirectory( tools/lemon )
625 add_subdirectory( ui )
626 add_subdirectory( wiretap )
627 add_subdirectory( wsutil )
629 add_custom_target(dumpabi DEPENDS dumpabi-libwireshark dumpabi-libwiretap dumpabi-libwsutil color.h)
631 if(ENABLE_ECHLD)
632         add_subdirectory( echld )
633 endif()
635 if(BUILD_wireshark AND GTK_FOUND)
636         add_subdirectory( ui/gtk )
637 endif()
639 if(BUILD_qtshark AND QT_FOUND)
640         add_subdirectory( ui/qt )
641 endif()
644 # Basedir where to install guides
645 set(DOC_DIR "$ENV{docdir}" CACHE FILEPATH "Installation directory for ug and dg pdfs.")
646 message(STATUS "docdir: ${DOC_DIR}")
648 if(ENABLE_GUIDES)
649         add_subdirectory( docbook )
650 endif()
652 if(ENABLE_PCAP_NG_DEFAULT)
653         set(PCAP_NG_DEFAULT 1)
654 endif()
656 # Large file support (e.g. make off_t 64 bit if supported)
657 include(gmxTestLargeFiles)
658 gmx_test_large_files(GMX_LARGEFILES)
660 add_definitions( -DTOP_SRCDIR=\"${CMAKE_SOURCE_DIR}\" )
662 if(APPLE)
663         #
664         # We assume that APPLE means OS X so that we have the OS X
665         # frameworks.
666         #
667         set(HAVE_OS_X_FRAMEWORKS 1)
668         FIND_LIBRARY (APPLE_APPLICATION_SERVICES_LIBRARY ApplicationServices)
669         FIND_LIBRARY (APPLE_CORE_FOUNDATION_LIBRARY CoreFoundation)
670         FIND_LIBRARY (APPLE_SYSTEM_CONFIGURATION_LIBRARY SystemConfiguration)
671 endif()
673 if(WIN32)
674         set(WS_MSVC_NORETURN "__declspec(noreturn)")
676         # Disable deprecation
677         if(MSVC80 OR MSVC90)
678                 add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
679         endif()
680 else()
681         set(WS_MSVC_NORETURN " ")
682 endif()
684 configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h)
686 set( configure_input "Built with CMake ${CMAKE_VERSION}" )
687 set( VERSION ${PROJECT_VERSION} )
689 configure_file(
690         ${CMAKE_SOURCE_DIR}/packaging/macosx/Info.plist.in
691         ${CMAKE_SOURCE_DIR}/packaging/macosx/Info.plist
692         @ONLY)
694 include(FeatureSummary)
695 #SET_FEATURE_INFO(NAME DESCRIPTION [URL [COMMENT] ]
696 #FEATURE_SUMMARY(WHAT ALL) Requires removal of our local copy of FeatureSummary
697 PRINT_ENABLED_FEATURES()
698 PRINT_DISABLED_FEATURES()
700 link_directories(
701         ${CMAKE_BINARY_DIR}/ui
702         ${CMAKE_BINARY_DIR}/ui/gtk
703         ${CMAKE_BINARY_DIR}/ui/qt
704         ${CMAKE_BINARY_DIR}/codecs
705         ${CMAKE_BINARY_DIR}/epan
706         ${CMAKE_BINARY_DIR}/wiretap
707         ${CMAKE_BINARY_DIR}/wsutil
710 ADD_CUSTOM_TARGET(
711         svnversion ALL
712         COMMAND ${PERL_EXECUTABLE}
713                 ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
714                 ${CMAKE_CURRENT_SOURCE_DIR}
715         DEPENDS
716                 ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
718 set_target_properties(svnversion PROPERTIES FOLDER "Auxiliary")
720 ADD_CUSTOM_COMMAND(
721         OUTPUT  svnversion.h
722         COMMAND ${PERL_EXECUTABLE}
723                 ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
724                 ${CMAKE_CURRENT_SOURCE_DIR}
725         DEPENDS
726                 ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
729 if(UNIX)
730         set(PLATFORM_CAPTURE_SRC
731                 capture-pcap-util-unix.c
732         )
733 endif()
735 if(WIN32)
736         set(PLATFORM_CAPTURE_SRC
737                 capture_win_ifnames.c
738                 capture-wpcap.c
739                 capture_wpcap_packet.c
740         )
741         set(PLATFORM_UI_SRC
742                 ui/win32/console_win32.c
743                 ui/win32/file_dlg_win32.c
744                 ui/win32/print_win32.c
745         )
746 endif()
748 set(WTAP_PLUGIN_SOURCES
749         epan/plugins.c
750         epan/filesystem.c
753 set(SHARK_COMMON_CAPTURE_SRC
754         capture_ifinfo.c
755         capture_ui_utils.c
758 set(WIRESHARK_COMMON_SRC
759         ${PLATFORM_CAPTURE_SRC}
760         capture-pcap-util.c
761         cfile.c
762         cfutils.c
763         clopts_common.c
764         frame_tvbuff.c
765         svnversion.h
766         sync_pipe_write.c
767         version_info.c
770 set(TSHARK_TAP_SRC
771         ui/cli/tap-afpstat.c
772         ui/cli/tap-ansi_astat.c
773         ui/cli/tap-bootpstat.c
774         ui/cli/tap-camelcounter.c
775         ui/cli/tap-camelsrt.c
776         ui/cli/tap-comparestat.c
777         ui/cli/tap-dcerpcstat.c
778         ui/cli/tap-diameter-avp.c
779         ui/cli/tap-expert.c
780         ui/cli/tap-follow.c
781         ui/cli/tap-funnel.c
782         ui/cli/tap-gsm_astat.c
783         ui/cli/tap-h225counter.c
784         ui/cli/tap-h225rassrt.c
785         ui/cli/tap-hosts.c
786         ui/cli/tap-httpstat.c
787         ui/cli/tap-icmpstat.c
788         ui/cli/tap-icmpv6stat.c
789         ui/cli/tap-iostat.c
790         ui/cli/tap-iousers.c
791         ui/cli/tap-macltestat.c
792         ui/cli/tap-mgcpstat.c
793         ui/cli/tap-megacostat.c
794         ui/cli/tap-protocolinfo.c
795         ui/cli/tap-protohierstat.c
796         ui/cli/tap-radiusstat.c
797         ui/cli/tap-rlcltestat.c
798         ui/cli/tap-rpcstat.c
799         ui/cli/tap-rpcprogs.c
800         ui/cli/tap-rtp.c
801         ui/cli/tap-rtspstat.c
802         ui/cli/tap-scsistat.c
803         ui/cli/tap-sctpchunkstat.c
804         ui/cli/tap-sipstat.c
805         ui/cli/tap-smbsids.c
806         ui/cli/tap-smbstat.c
807         ui/cli/tap-stats_tree.c
808         ui/cli/tap-sv.c
809         ui/cli/tap-wspstat.c
812 set(INSTALL_DIRS
813         diameter
814         dtds
815         help
816         radius
817         tpncp
818         wimaxasncp
821 set(INSTALL_FILES
822         ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
823         COPYING
824         ${CMAKE_BINARY_DIR}/capinfos.html
825         cfilters
826         colorfilters
827         dfilters
828         ${CMAKE_BINARY_DIR}/dftest.html
829         ${CMAKE_BINARY_DIR}/dumpcap.html
830         ${CMAKE_BINARY_DIR}/editcap.html
831         ${CMAKE_BINARY_DIR}/asn2deb.html
832         ${CMAKE_BINARY_DIR}/idl2deb.html
833         ${CMAKE_BINARY_DIR}/idl2wrs.html
834         ipmap.html
835         manuf
836         ${CMAKE_BINARY_DIR}/mergecap.html
837         pdml2html.xsl
838         ${CMAKE_BINARY_DIR}/randpkt.html
839         ${CMAKE_BINARY_DIR}/rawshark.html
840         ${CMAKE_BINARY_DIR}/reordercap.html
841         services
842         smi_modules
843         ${CMAKE_BINARY_DIR}/text2pcap.html
844         ${CMAKE_BINARY_DIR}/tshark.html
845         ${CMAKE_BINARY_DIR}/wireshark-filter.html
846         ${CMAKE_BINARY_DIR}/wireshark.html
847         docbook/ws.css
850 set(LIBEPAN_LIBS
851 #               @NSL_LIBS@      # -lnsl
852 #               @SOCKET_LIBS@   # -lsocket
853 #               @SSL_LIBS@      # -lcrypto
854                 epan
855 #               $(plugin_ldadd) # in case of static
856                 ${AIRPCAP_LIBRARIES}
857                 ${PCAP_LIBRARIES}
858                 ${CARES_LIBRARIES}
859                 ${ADNS_LIBRARIES}
860                 ${KERBEROS_LIBRARIES}
861                 ${LUA_LIBRARIES}
862                 ${PYTHON_LIBRARIES}
863                 ${GEOIP_LIBRARIES}
864                 ${GCRYPT_LIBRARIES}
865                 ${GNUTLS_LIBRARIES}
866                 ${SMI_LIBRARIES}
867                 ${ZLIB_LIBRARIES}
868                 ${M_LIBRARIES}
871 if( (BUILD_wireshark AND GTK_FOUND) OR (BUILD_qtshark AND QT_FOUND) )
872         set(wireshark_FILES
873                 airpcap_loader.c
874                 capture.c
875                 capture_info.c
876                 capture_opts.c
877                 capture_sync.c
878                 color_filters.c
879                 file.c
880                 fileset.c
881                 filters.c
882                 iface_monitor.c
883                 proto_hier_stats.c
884                 summary.c
885                 ws80211_utils.c
886                 ${SHARK_COMMON_CAPTURE_SRC}
887                 ${WIRESHARK_COMMON_SRC}
888                 ${PLATFORM_UI_SRC}
889         )
890 endif()
892 if(BUILD_wireshark AND GTK_FOUND)
893         set(wireshark_LIBS
894                 gtkui
895                 ui
896                 ${GTK2_LIBRARIES}
897                 ${GTK3_LIBRARIES}
898                 ${GTHREAD2_LIBRARIES}
899                 codecs
900                 ${PORTAUDIO_LIBRARIES}
901                 ${LIBEPAN_LIBS}
902                 ${APPLE_APPLICATION_SERVICES_LIBRARY}
903                 ${APPLE_CORE_SERVICES_LIBRARY}
904                 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
905                 ${NL_LIBRARIES}
906                 ${WIN_COMCTL32_LIBRARY}
907         )
908         # qtshark and wireshark share wireshark_FILES
910         add_executable(wireshark ${wireshark_FILES})
911         add_dependencies(wireshark svnversion)
912         set_target_properties(wireshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
913         set_target_properties(wireshark PROPERTIES FOLDER "Executables")
914         target_link_libraries(wireshark ${wireshark_LIBS})
915         install(TARGETS wireshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
916 endif()
918 if(BUILD_qtshark AND QT_FOUND)
919         set(qtshark_LIBS
920                 qtui
921                 ui
922                 ${QT_LIBRARIES}
923                 ${GTHREAD2_LIBRARIES}
924                 codecs
925                 ${LIBEPAN_LIBS}
926                 ${APPLE_APPLICATION_SERVICES_LIBRARY}
927                 ${APPLE_CORE_FOUNDATION_LIBRARY}
928                 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
929                 ${NL_LIBRARIES}
930         )
931         # qtshark and wireshark share wireshark_FILES
933         add_executable(qtshark ${wireshark_FILES})
934         add_dependencies(qtshark svnversion)
935         set_target_properties(qtshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
936         set_target_properties(qtshark PROPERTIES FOLDER "Executables")
937         target_link_libraries(qtshark ${qtshark_LIBS})
938         install(TARGETS qtshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
939 endif()
941 register_tap_files(tshark-tap-register.c
942         tshark-taps
943         ${TSHARK_TAP_SRC}
946 if(BUILD_tshark)
947         set(tshark_LIBS
948                 ui
949                 ${LIBEPAN_LIBS}
950                 ${APPLE_CORE_FOUNDATION_LIBRARY}
951                 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
952         )
953         set(tshark_FILES
954                 capture_opts.c
955                 capture_sync.c
956                 tshark-tap-register.c
957                 tshark.c
958                 ${TSHARK_TAP_SRC}
959                 ${SHARK_COMMON_CAPTURE_SRC}
960                 ${WIRESHARK_COMMON_SRC}
961         )
962         add_executable(tshark ${tshark_FILES})
963         add_dependencies(tshark svnversion)
964         set_target_properties(tshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
965         set_target_properties(tshark PROPERTIES FOLDER "Executables")
966         target_link_libraries(tshark ${tshark_LIBS})
967         install(TARGETS tshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
968 endif()
970 if(BUILD_rawshark AND PCAP_FOUND)
971         set(rawshark_LIBS
972                 ${LIBEPAN_LIBS}
973                 ${APPLE_CORE_FOUNDATION_LIBRARY}
974                 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
975         )
976         set(rawshark_FILES
977                 ${WIRESHARK_COMMON_SRC}
978                 rawshark.c
979                 ui/util.c
980         )
981         add_executable(rawshark ${rawshark_FILES})
982         add_dependencies(rawshark svnversion)
983         set_target_properties(rawshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
984         set_target_properties(rawshark PROPERTIES FOLDER "Executables")
985         target_link_libraries(rawshark ${rawshark_LIBS})
986         install(TARGETS rawshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
987 endif()
989 if(BUILD_dftest)
990         set(dftest_LIBS
991                 ${LIBEPAN_LIBS}
992         )
993         set(dftest_FILES
994                 dftest.c
995                 ui/util.c
996         )
997         add_executable(dftest ${dftest_FILES})
998         set_target_properties(dftest PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
999         set_target_properties(dftest PROPERTIES FOLDER "Executables")
1000         target_link_libraries(dftest ${dftest_LIBS})
1001         install(TARGETS dftest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1002 endif()
1004 if(BUILD_randpkt)
1005         set(randpkt_LIBS
1006                 wiretap
1007                 wsutil
1008                 ${M_LIBRARIES}
1009                 ${PCAP_LIBRARIES}
1010 #               @SOCKET_LIBS@
1011 #               @NSL_LIBS@
1012                 ${CARES_LIBRARIES}
1013                 ${ADNS_LIBRARIES}
1014                 ${ZLIB_LIBRARIES}
1015         )
1016         set(randpkt_FILES
1017                 randpkt.c
1018         )
1019         add_executable(randpkt ${randpkt_FILES})
1020         set_target_properties(randpkt PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1021         set_target_properties(randpkt PROPERTIES FOLDER "Executables")
1022         target_link_libraries(randpkt ${randpkt_LIBS})
1023         install(TARGETS randpkt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1024 endif()
1026 if(BUILD_text2pcap)
1027         set(text2pcap_LIBS
1028                 wsutil
1029                 ${M_LIBRARIES}
1030                 ${ZLIB_LIBRARIES}
1031         )
1032         set(text2pcap_CLEAN_FILES
1033                 text2pcap.c
1034                 pcapio.c
1035         )
1036         set(text2pcap_FILES
1037                 ${text2pcap_CLEAN_FILES}
1038         )
1039         add_lex_files(text2pcap_FILES
1040                 text2pcap-scanner.l
1041         )
1042         add_executable(text2pcap ${text2pcap_FILES})
1043         add_dependencies(text2pcap svnversion)
1044         set_target_properties(text2pcap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1045         set_target_properties(text2pcap PROPERTIES FOLDER "Executables")
1046         target_link_libraries(text2pcap ${text2pcap_LIBS})
1047         install(TARGETS text2pcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1048 endif()
1050 if(BUILD_mergecap)
1051         set(mergecap_LIBS
1052                 wiretap
1053                 ${ZLIB_LIBRARIES}
1054                 ${CMAKE_DL_LIBS}
1055         )
1056         set(mergecap_FILES
1057                 mergecap.c
1058                 svnversion.h
1059                 ${WTAP_PLUGIN_SOURCES}
1060         )
1061         add_executable(mergecap ${mergecap_FILES})
1062         add_dependencies(mergecap svnversion)
1063         set_target_properties(mergecap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1064         set_target_properties(mergecap PROPERTIES FOLDER "Executables")
1065         target_link_libraries(mergecap ${mergecap_LIBS})
1066         install(TARGETS mergecap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1067 endif()
1069 if(BUILD_reordercap)
1070         set(reordercap_LIBS
1071                 wiretap
1072                 ${ZLIB_LIBRARIES}
1073                 ${CMAKE_DL_LIBS}
1074         )
1075         set(reordercap_FILES
1076                 reordercap.c
1077                 svnversion.h
1078                 ${WTAP_PLUGIN_SOURCES}
1079         )
1080         add_executable(reordercap ${reordercap_FILES})
1081         add_dependencies(reordercap svnversion)
1082         set_target_properties(reordercap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1083         set_target_properties(reordercap PROPERTIES FOLDER "Executables")
1084         target_link_libraries(reordercap ${reordercap_LIBS})
1085         install(TARGETS reordercap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1086 endif()
1088 if(BUILD_capinfos)
1089         set(capinfos_LIBS
1090                 wiretap
1091                 wsutil
1092                 ${ZLIB_LIBRARIES}
1093                 ${GCRYPT_LIBRARIES}
1094                 ${CMAKE_DL_LIBS}
1095         )
1096         set(capinfos_FILES
1097                 capinfos.c
1098                 ${WTAP_PLUGIN_SOURCES}
1099         )
1100         add_executable(capinfos ${capinfos_FILES})
1101         add_dependencies(capinfos svnversion)
1102         set_target_properties(capinfos PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1103         set_target_properties(capinfos PROPERTIES FOLDER "Executables")
1104         target_link_libraries(capinfos ${capinfos_LIBS})
1105         install(TARGETS capinfos RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1106 endif()
1108 if(BUILD_editcap)
1109         set(editcap_LIBS
1110                 wiretap
1111                 ${ZLIB_LIBRARIES}
1112                 ${CMAKE_DL_LIBS}
1113         )
1114         set(editcap_FILES
1115                 editcap.c
1116                 ${WTAP_PLUGIN_SOURCES}
1117         )
1118         add_executable(editcap ${editcap_FILES})
1119         add_dependencies(editcap svnversion)
1120         set_target_properties(editcap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1121         set_target_properties(editcap PROPERTIES FOLDER "Executables")
1122         target_link_libraries(editcap ${editcap_LIBS})
1123         install(TARGETS editcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1124 endif()
1126 if(BUILD_dumpcap AND PCAP_FOUND)
1127         set(dumpcap_LIBS
1128                 wsutil
1129                 ${PCAP_LIBRARIES}
1130                 ${CAP_LIBRARIES}
1131 #               @SOCKET_LIBS@
1132 #               @NSL_LIBS@
1133                 ${GLIB2_LIBRARIES}
1134                 ${GTHREAD2_LIBRARIES}
1135                 ${ZLIB_LIBRARIES}
1136                 ${APPLE_CORE_FOUNDATION_LIBRARY}
1137                 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
1138                 ${NL_LIBRARIES}
1139         )
1140         set(dumpcap_FILES
1141                 svnversion.h
1142                 capture_opts.c
1143                 capture-pcap-util.c
1144                 capture_stop_conditions.c
1145                 cfutils.c
1146                 clopts_common.c
1147                 conditions.c
1148                 dumpcap.c
1149                 pcapio.c
1150                 ringbuffer.c
1151                 sync_pipe_write.c
1152                 version_info.c
1153                 ws80211_utils.c
1154                 ${PLATFORM_CAPTURE_SRC}
1155         )
1156         add_executable(dumpcap ${dumpcap_FILES})
1157         add_dependencies(dumpcap svnversion)
1158         set_target_properties(dumpcap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1159         set_target_properties(dumpcap PROPERTIES FOLDER "Executables")
1160         target_link_libraries(dumpcap ${dumpcap_LIBS})
1161         install(TARGETS dumpcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1162 endif()
1164 ADD_CUSTOM_COMMAND(
1165         OUTPUT  ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
1166         COMMAND ${PERL_EXECUTABLE}
1167                 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
1168                 ${CMAKE_SOURCE_DIR}/doc/make-authors-short.pl
1169                 < ${CMAKE_SOURCE_DIR}/AUTHORS
1170                 > ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
1171         DEPENDS
1172                 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
1173                 ${CMAKE_SOURCE_DIR}/doc/make-authors-short.pl
1174                 ${CMAKE_SOURCE_DIR}/AUTHORS
1177 ADD_CUSTOM_COMMAND(
1178         OUTPUT  ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
1179                 ${CMAKE_BINARY_DIR}/wireshark.pod
1180         COMMAND ${PERL_EXECUTABLE}
1181                 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
1182                 ${CMAKE_SOURCE_DIR}/doc/make-authors-format.pl
1183                 < ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
1184                 > ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
1185         COMMAND cat
1186                 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
1187                 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
1188                 > ${CMAKE_BINARY_DIR}/wireshark.pod
1189         DEPENDS
1190                 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
1191                 ${CMAKE_SOURCE_DIR}/doc/make-authors-format.pl
1192                 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
1193                 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
1196 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/capinfos 1 )
1197 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dftest 1 )
1198 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dumpcap 1 )
1199 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/editcap 1 )
1200 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/asn2deb 1 )
1201 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2deb 1 )
1202 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2wrs 1 )
1203 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/mergecap 1 )
1204 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/randpkt 1 )
1205 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/rawshark 1 )
1206 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/reordercap 1 )
1207 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/text2pcap 1 )
1208 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/tshark 1 )
1209 pod2manhtml( ${CMAKE_BINARY_DIR}/wireshark 1 )
1210 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/wireshark-filter 4 )
1212 add_custom_target(
1213         auxiliary ALL
1214         DEPENDS
1215                 AUTHORS-SHORT
1216                 capinfos.html
1217                 dftest.html
1218                 dumpcap.html
1219                 editcap.html
1220                 asn2deb.html
1221                 idl2deb.html
1222                 idl2wrs.html
1223                 mergecap.html
1224                 randpkt.html
1225                 rawshark.html
1226                 reordercap.html
1227                 text2pcap.html
1228                 tshark.html
1229                 wireshark.html
1230                 wireshark-filter.html
1232 set_target_properties(auxiliary PROPERTIES FOLDER "Docs")
1234 set(MAN1_FILES
1235         ${CMAKE_BINARY_DIR}/capinfos.1
1236         ${CMAKE_BINARY_DIR}/dftest.1
1237         ${CMAKE_BINARY_DIR}/dumpcap.1
1238         ${CMAKE_BINARY_DIR}/editcap.1
1239         ${CMAKE_BINARY_DIR}/idl2wrs.1
1240         ${CMAKE_BINARY_DIR}/mergecap.1
1241         ${CMAKE_BINARY_DIR}/randpkt.1
1242         ${CMAKE_BINARY_DIR}/rawshark.1
1243         ${CMAKE_BINARY_DIR}/reordercap.1
1244         ${CMAKE_BINARY_DIR}/text2pcap.1
1245         ${CMAKE_BINARY_DIR}/tshark.1
1246         ${CMAKE_BINARY_DIR}/wireshark.1
1249 set(MAN4_FILES
1250         ${CMAKE_BINARY_DIR}/wireshark-filter.4
1253 set(CLEAN_FILES
1254         ${wireshark_FILES}
1255         ${tshark_FILES}
1256         ${rawshark_FILES}
1257         ${dftest_FILES}
1258         ${randpkt_FILES}
1259         ${text2pcap_CLEAN_FILES}
1260         ${mergecap_FILES}
1261         ${capinfos_FILES}
1262         ${editcap_FILES}
1263         ${dumpcap_FILES}
1266 if (WERROR)
1267         set_source_files_properties(
1268                 ${CLEAN_FILES}
1269                 PROPERTIES
1270                 COMPILE_FLAGS -Werror
1271         )
1272 endif()
1274 install(
1275         FILES
1276                 ${INSTALL_FILES}
1277         DESTINATION
1278                 ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
1281 install(
1282         FILES
1283                 ${MAN1_FILES}
1284         DESTINATION
1285                 ${CMAKE_INSTALL_MANDIR}/man1
1288 install(
1289         FILES
1290                 ${MAN4_FILES}
1291         DESTINATION
1292                 ${CMAKE_INSTALL_MANDIR}/man4
1295 install(
1296         DIRECTORY
1297                 ${INSTALL_DIRS}
1298         DIRECTORY_PERMISSIONS
1299                 OWNER_EXECUTE OWNER_WRITE OWNER_READ
1300                 GROUP_EXECUTE GROUP_READ
1301                 WORLD_EXECUTE WORLD_READ
1302         DESTINATION
1303                 ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
1304         PATTERN ".svn" EXCLUDE
1305         PATTERN "Makefile.*" EXCLUDE
1306         PATTERN "faq.py" EXCLUDE
1310 if(DOC_DIR)
1311         message(STATUS "Docdir install: ${DOC_DIR}")
1312         INSTALL(
1313                 DIRECTORY
1314                         ${CMAKE_BINARY_DIR}/docbook/
1315                 DIRECTORY_PERMISSIONS
1316                         OWNER_EXECUTE OWNER_WRITE OWNER_READ
1317                         GROUP_EXECUTE GROUP_READ
1318                         WORLD_EXECUTE WORLD_READ
1319                 DESTINATION
1320                         ${DOC_DIR}/guides
1321                 FILES_MATCHING
1322                 PATTERN "*.pdf"
1323         )
1324 endif()