- Fix logic for finding packages with differing Find-name
[metze/wireshark/wip.git] / CMakeLists.txt
1 # CMakeLists.txt
2 #
3 # $Id$
4 #
5 # Wireshark - Network traffic analyzer
6 # By Gerald Combs <gerald@wireshark.org>
7 # Copyright 1998 Gerald Combs
8 #
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.
13 #
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.
18 #
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.
22 #
23
24 project(Wireshark C CXX)
25
26 cmake_minimum_required(VERSION 2.6)
27 set(CMAKE_BACKWARDS_COMPATIBILITY 2.6)
28
29 # Needs to be set after cmake_minimum_required or cmake_policy(VERSION)
30 if(COMMAND cmake_policy)
31         # Backward compatibility for versions < 2.6.3
32         cmake_policy(SET CMP0011 OLD)
33 #       cmake_policy(SET CMP0015 NEW)
34 endif(COMMAND cmake_policy)
35
36 # set(PROJECT_MAJOR_VERSION 1)
37 # set(PROJECT_MINOR_VERSION 9)
38 # set(PROJECT_PATCH_VERSION 0)
39 # set(PROJECT_VERSION_EXTENSION "-rc5")
40 # If not set, copy over Wireshark version from configure.ac
41 if(NOT PROJECT_MAJOR_VERSION)
42         file(STRINGS
43                 ${CMAKE_SOURCE_DIR}/configure.ac
44                 PROJECT_MAJOR_VERSION_TMP
45                 REGEX "^m4_define\\(\\[?version_major\\]?, *\\[?[0-9]+\\]?\\)"
46         )
47         file(STRINGS
48                 ${CMAKE_SOURCE_DIR}/configure.ac
49                 PROJECT_MINOR_VERSION_TMP
50                 REGEX "^m4_define\\(\\[?version_minor\\]?, *\\[?[0-9]+\\]?\\)"
51         )
52         file(STRINGS
53                 ${CMAKE_SOURCE_DIR}/configure.ac
54                 PROJECT_PATCH_VERSION_TMP
55                 REGEX "^m4_define\\(\\[?version_micro\\]?, *\\[?[0-9]+\\]?\\)"
56         )
57         # XXX pull VERSION_EXTENSION out of configure.ac ?
58
59         string(REGEX REPLACE "m4_define\\(\\[?version_major\\]?, *\\[?([0-9]+)\\]?\\)"
60                 "\\1"
61                 PROJECT_MAJOR_VERSION
62                 ${PROJECT_MAJOR_VERSION_TMP}
63         )
64         string(REGEX REPLACE "m4_define\\(\\[?version_minor\\]?, *\\[?([0-9]+)\\]?\\)"
65                 "\\1"
66                 PROJECT_MINOR_VERSION
67                 ${PROJECT_MINOR_VERSION_TMP}
68         )
69         string(REGEX REPLACE "m4_define\\(\\[?version_micro\\]?, *\\[?([0-9]+)\\]?\\)"
70                 "\\1"
71                 PROJECT_PATCH_VERSION
72                 ${PROJECT_PATCH_VERSION_TMP}
73         )
74 endif()
75
76
77 if(PROJECT_VERSION_EXTENSION)
78         set(PROJECT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}${PROJECT_VERSION_EXTENSION})
79 else()
80         set(PROJECT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION})
81 endif()
82
83 message(STATUS "V: ${PROJECT_VERSION}, MaV: ${PROJECT_MAJOR_VERSION}, MiV: ${PROJECT_MINOR_VERSION}, PL: ${PROJECT_PATCH_VERSION}, EV: ${PROJECT_VERSION_EXTENSION}.")
84
85 #Where to find local cmake scripts
86 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
87 INCLUDE(UseLemon)
88 INCLUDE(UseMakeDissectorReg)
89 INCLUDE(UseMakeTapReg)
90
91 # Under linux the release mode (CMAKE_BUILD_TYPE=release) defines NDEBUG
92
93 # Enable with: "make VERBOSE=1"
94 set(CMAKE_VERBOSE_MAKEFILE OFF)
95
96 #Defines CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_DATADIR, etc ...
97 include(CMakeInstallDirs)
98
99 include_directories(
100         ${CMAKE_BINARY_DIR}
101         ${CMAKE_SOURCE_DIR}
102         ${CMAKE_SOURCE_DIR}/epan
103         ${CMAKE_SOURCE_DIR}/tools/lemon
104         ${CMAKE_SOURCE_DIR}/wiretap
105 )
106
107 #Where to put libraries
108 if(NOT LIBRARY_OUTPUT_PATH)
109         set(LIBRARY_OUTPUT_PATH ${Wireshark_BINARY_DIR}/lib CACHE INTERNAL
110                    "Single output directory for building all libraries.")
111 endif()
112
113
114 include(CMakeOptions.txt)
115
116
117 set(WIRESHARK_C_FLAGS
118         -O2
119         -g
120         -Wall
121         -W
122         -Wextra
123         -Wendif-labels
124         -Wpointer-arith
125         -Warray-bounds
126         -Wcast-align
127         -Wformat-security
128         -fexcess-precision=fast
129 )
130
131 set(WIRESHARK_C_ONLY_FLAGS
132         # The following are C only, not C++
133         -Wc++-compat
134         -Wdeclaration-after-statement
135         -Wno-pointer-sign
136         -Wold-style-definition
137         -Wshadow
138 )
139
140 set(WIRESHARK_EXTRA_C_FLAGS
141         -pedantic
142         -Woverflow
143         -Wlogical-op
144         -Wno-overlength-strings
145         -fstrict-overflow -Wstrict-overflow=4
146         -Wunreachable-code
147         -Wunsafe-loop-optimizations
148         -Wno-long-long
149         -Wcast-qual
150         -Waddress
151         -Warray-bounds
152         -Wattributes
153         -Wdiv-by-zero
154         -Wformat-security
155         -Wignored-qualifiers
156         -Wpragmas
157         -Wredundant-decls
158         -Wvla
159         # packet-ncp2222.inc prevents this from going into all warnings
160         -Wwrite-strings
161         # All the registration functions block these for now.
162         -Wmissing-declarations
163         # Problem with packet-afs.c
164         -Wshadow
165         # More cleanup needed for this on LP64
166         -Wshorten-64-to-32
167
168 )
169
170 set(WIRESHARK_EXTRA_C_ONLY_FLAGS
171         # The following are C only, not C++
172         -Wbad-function-cast
173         -Wjump-misses-init
174         # GLib blocks this for now.
175         -Wstrict-prototypes
176         # All the registration functions block these for now.
177         -Wmissing-prototypes
178 )
179
180 if(ENABLE_EXTRA_GCC_CHECKS)   # This overrides -Werror
181         set(WIRESHARK_C_FLAGS ${WIRESHARK_C_FLAGS} ${WIRESHARK_EXTRA_C_FLAGS})
182         set(WIRESHARK_C_ONLY_FLAGS ${WIRESHARK_C_ONLY_FLAGS} ${WIRESHARK_EXTRA_C_ONLY_FLAGS})
183 endif()
184
185 add_definitions(
186         -DG_DISABLE_DEPRECATED
187         -DG_DISABLE_SINGLE_INCLUDES
188 )
189
190 # Counterhack to work around some cache magic in CHECK_C_SOURCE_COMPILES
191 include(CheckCCompilerFlag)
192 set(C 0)
193 # Sigh: Have to use THIS_FLAG instead of ${F} for some reason
194 foreach(THIS_FLAG ${WIRESHARK_C_FLAGS})
195         set(F WS_C_FLAG_${C})
196         set(${F} ${THIS_FLAG})
197         set(V WS_C_FLAG_VALID${C})
198         check_c_compiler_flag(${${F}} ${V})
199         if (${${V}})
200                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${${F}}")
201                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${F}}")
202         endif()
203         math(EXPR C "${C} + 1")
204 endforeach()
205 # Continue increasing C from previous loop
206 foreach(THIS_FLAG ${WIRESHARK_C_ONLY_FLAGS})
207         set(F WS_C_FLAG_${C})
208         set(${F} ${THIS_FLAG})
209         set(V WS_C_FLAG_VALID${C})
210         check_c_compiler_flag(${${F}} ${V})
211         if (${${V}})
212                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${${F}}")
213         endif()
214         math(EXPR C "${C} + 1")
215 endforeach()
216 message(STATUS "C-Flags: ${CMAKE_C_FLAGS}\nCXX-Flags: ${CMAKE_CXX_FLAGS}")
217
218 check_c_compiler_flag(-fvisibility=hidden FVHIDDEN)
219 if((FVHIDDEN))
220         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
221 else() # TODO add alternate compiler flags for hiding symbols
222         message(WARNING "Hiding shared library symbols is not supported by the compiler."
223                 " All shared library symbols will be exported.")
224 endif()
225
226 if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_GCC_CHECKS)
227         check_c_compiler_flag(-Werror WERROR)
228 else()
229         unset(WERROR)
230 endif()
231
232 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER MATCHES ".*clang")
233         set (C_UNUSED "__attribute__((unused))" )
234 else()
235         set (C_UNUSED "" )
236 endif()
237
238 set(WIRESHARK_LD_FLAGS
239         -Wl,--as-needed
240         # -flto
241         # -fwhopr
242         # -fwhole-program
243 )
244
245 include(CheckCLinkerFlag)
246 set(C 0)
247 # Sigh: Have to use THIS_FLAG instead of ${F} for some reason
248 foreach(THIS_FLAG ${WIRESHARK_LD_FLAGS})
249         set(F WS_LD_FLAG_${C})
250         set(${F} ${THIS_FLAG})
251         set(V WS_LD_FLAG_VALID${C})
252         check_c_linker_flag(${${F}} ${V})
253         if (${${V}})
254                 set(WS_LINK_FLAGS ${WS_LINK_FLAGS} ${${F}})
255         endif()
256         math(EXPR C "${C} + 1")
257 endforeach()
258
259 if(ENABLE_STATIC)
260   set(LINK_MODE_LIB STATIC)
261   set(LINK_MODE_MODULE STATIC)
262 else()
263   set(LINK_MODE_LIB SHARED)
264   set(LINK_MODE_MODULE MODULE)
265 endif()
266
267 # The packagelist is doing some magic:  If we add XXX to the packagelist, we
268 # - may optionally set XXX_OPTIONS to pass to the find_package command
269 # - will call FindXXX.cmake
270 # - return found libraries in XXX_LIBRARIES
271 # - return found include in XXX_INCLUDE_DIRS
272 # - set HAVE_XXX
273
274 #The minimum package list
275 set(PACKAGELIST GLIB2 GMODULE2 GTHREAD2 M LEX YACC Perl SH PythonInterp)
276 set(GLIB2_FIND_REQUIRED)
277 set(GLIB2_MIN_VERSION 2.14.0)
278 set(GTHREAD2_REQUIRED)
279 set(PCAP_REQUIRED)
280 set(M_REQUIRED)
281 set(PythonInterp_FIND_VERSION 2)
282
283 set(PACKAGELIST ${PACKAGELIST} HtmlViewer)
284
285 if(ENABLE_PCAP)
286         set(PACKAGELIST ${PACKAGELIST} PCAP)
287 endif()
288
289 # Build the GTK-GUI?
290 if(BUILD_wireshark)
291         if(ENABLE_GTK3)
292                 set(PACKAGELIST ${PACKAGELIST} GTK3)
293         else()
294                 set(PACKAGELIST ${PACKAGELIST} GTK2)
295                 set(GTK2_OPTIONS COMPONENTS gtk)
296                 set(GTK2_FIND_VERSION 2.12)
297                 set(GTK2_DEBUG false)
298         endif()
299 endif()
300
301 # Build the Qt GUI?
302 if(BUILD_qtshark)
303         if(ENABLE_QT5)
304                 set(PACKAGELIST ${PACKAGELIST} Qt5Widgets Qt5PrintSupport Qt5LinguistTools)
305                 set(QT_VERSION 5)
306         else()
307                 set(PACKAGELIST ${PACKAGELIST} Qt4)
308                 # set(Qt4_OPTIONS 4.7.1 REQUIRED QtCore QtGui)
309                 set(QT_VERSION 4)
310         endif()
311 endif()
312
313 # SMI SNMP
314 if(ENABLE_SMI)
315         set(PACKAGELIST ${PACKAGELIST} SMI)
316 endif()
317
318 # GNU crypto
319 if(ENABLE_GCRYPT)
320         set(PACKAGELIST ${PACKAGELIST} GCRYPT)
321 endif()
322
323 # GNU SSL/TLS support
324 if(ENABLE_GNUTLS)
325         set(PACKAGELIST ${PACKAGELIST} GNUTLS)
326 endif()
327
328 # Kerberos
329 if(ENABLE_KERBEROS)
330         set(PACKAGELIST ${PACKAGELIST} KERBEROS)
331 endif()
332
333 # Portable audio
334 if(ENABLE_PORTAUDIO)
335         set(PACKAGELIST ${PACKAGELIST} PORTAUDIO)
336 endif()
337
338
339 # Prefer c-ares over adns
340 if(ENABLE_CARES)        # C Asynchronouse resolver
341         set(PACKAGELIST ${PACKAGELIST} CARES)
342 elseif(ENABLE_ADNS)     # Gnu asynchronous DNS
343         set(PACKAGELIST ${PACKAGELIST} ADNS)
344 endif()
345
346 # Zlib compression
347 if(ENABLE_ZLIB)
348         set(PACKAGELIST ${PACKAGELIST} ZLIB)
349 endif()
350
351 # Lua 5.1 dissectors
352 if(ENABLE_LUA)
353         set(PACKAGELIST ${PACKAGELIST} LUA)
354 endif()
355
356 # GeoIP address resolving
357 if(ENABLE_GEOIP)
358         set(PACKAGELIST ${PACKAGELIST} GEOIP)
359 endif()
360
361 if(ENABLE_NETLINK)
362         set(PACKAGELIST ${PACKAGELIST} NL)
363 endif()
364
365 # Capabilities
366 if(ENABLE_CAP)
367         set(PACKAGELIST ${PACKAGELIST} CAP)
368 endif()
369
370 if(ENABLE_PYTHON)
371         set(PACKAGELIST ${PACKAGELIST} PythonLibs)
372 endif()
373
374 set(PACKAGELIST ${PACKAGELIST} YAPP)
375
376 set(PACKAGELIST ${PACKAGELIST} POD)
377
378
379 set(PROGLIST text2pcap mergecap capinfos editcap reordercap dumpcap)
380
381 #Let's loop the package list
382 foreach(PACKAGE ${PACKAGELIST})
383         if(${PACKAGE} STREQUAL "Qt4")
384                 set(PACKAGE_VAR "QT")
385         elseif(${PACKAGE} STREQUAL "PythonInterp")
386                 set(PACKAGE_VAR "PYTHON")
387         elseif(${PACKAGE} STREQUAL "PythonLibs")
388                 set(PACKAGE_VAR "PYTHON")
389         else()
390                 set(PACKAGE_VAR ${PACKAGE})
391         endif()
392         if(${PACKAGE}_OPTIONS)
393                 find_package(${PACKAGE} ${${PACKAGE}_OPTIONS})
394         elseif(${PACKAGE}_REQUIRED)
395                 find_package(${PACKAGE} REQUIRED)
396         else()
397                 find_package(${PACKAGE})
398         endif()
399         message(${PACKAGE_VAR}_FOUND)
400         if (${PACKAGE_VAR}_FOUND)
401                 set(HAVE_LIB${PACKAGE_VAR} 1)
402                 include_directories(${${PACKAGE_VAR}_INCLUDE_DIRS})
403                 message(STATUS "${PACKAGE} includes: ${${PACKAGE_VAR}_INCLUDE_DIRS}")
404                 message(STATUS "${PACKAGE} libs: ${${PACKAGE_VAR}_LIBRARIES}")
405                 if (${PACKAGE}_DEFINITIONS)
406                         message(STATUS "${PACKAGE} definitions: ${${PACKAGE_VAR}_DEFINITIONS}")
407                 endif()
408                 if (${PACKAGE_VAR}_EXECUTABLE)
409                         message(STATUS "${PACKAGE} executable: ${${PACKAGE_VAR}_EXECUTABLE}")
410                 endif()
411         endif()
412 endforeach()
413
414 #packaging
415 include(CPackConfig.txt)
416
417 if(HAVE_LIBPYTHON)
418         set(HAVE_PYTHON 1)
419         set(PYTHON_DIR "${CMAKE_INSTALL_PREFIX}/lib/wireshark/python/${CPACK_PACKAGE_VERSION}")
420 endif()
421 if(HAVE_LIBLUA)
422         set(HAVE_LUA_H 1)
423         set(HAVE_LUA 1)
424 endif()
425 if(HAVE_LIBKERBEROS)
426         set(HAVE_KERBEROS 1)
427         # HAVE_HEIMDAL_KERBEROS
428         set(HAVE_MIT_KERBEROS 1)
429         set(HAVE_KEYTYPE_ARCFOUR_56 1)
430 endif()
431 if(HAVE_LIBGEOIP)
432         set(HAVE_GEOIP 1)
433 endif()
434 if(HAVE_LIBCARES)
435         set(HAVE_C_ARES 1)
436 endif()
437 if(HAVE_LIBADNS)
438         set(HAVE_GNU_ADNS 1)
439 endif()
440 if(ENABLE_AIRPCAP)
441         set(HAVE_AIRPCAP 1)
442 endif()
443 if(HAVE_LIBNL AND ENABLE_AIRPCAP)
444         message(ERROR "Airpcap and Libnl support are mutually exclusive")
445 endif()
446 # No matter which version of GTK is present
447 if(GTK2_FOUND OR GTK3_FOUND)
448         set(GTK_FOUND ON)
449 endif()
450 # That's the name autofoo uses
451 if(HAVE_LIBZLIB)
452         set(HAVE_LIBZ 1)
453 endif()
454 if (Qt5Widgets_FOUND)
455         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
456         if (Qt5_POSITION_INDEPENDENT_CODE)
457                 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
458         endif()
459         set (QT_FOUND ON)
460         set (QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES})
461 # If Qt4: QT_LIBRARIES and QT_INCLUDES are not set above. They require extra magic
462 elseif(QT_FOUND)
463         include(${QT_USE_FILE})
464         include_directories(${QT_INCLUDE_DIR})
465         message(STATUS "QT includes: ${QT_INCLUDE_DIR}")
466         message(STATUS "QT libs: ${QT_LIBRARIES}")
467 endif()
468 include(ConfigureChecks.cmake)
469
470 #Big or little endian ?
471 include(TestBigEndian)
472 test_big_endian(WORDS_BIGENDIAN)
473
474 set(DATAFILE_DIR "${CMAKE_INSTALL_PREFIX}/share/${CPACK_PACKAGE_NAME}")
475
476 if(ENABLE_PLUGINS)
477         set(HAVE_PLUGINS 1)
478         set(PLUGIN_DIR="${DATAFILE_DIR}/plugins/${CPACK_PACKAGE_VERSION}")
479         set(PLUGIN_SRC_DIRS
480                 plugins/asn1
481                 plugins/docsis
482                 plugins/ethercat
483                 plugins/gryphon
484                 plugins/irda
485                 plugins/m2m
486                 plugins/mate
487                 plugins/opcua
488                 plugins/profinet
489                 plugins/stats_tree
490                 plugins/unistim
491                 plugins/wimax
492                 plugins/wimaxasncp
493                 plugins/wimaxmacphy
494         )
495 # It seems this stuff doesn't build with autofoo either...
496 #       if(YAPP_FOUND)
497 #               set(PLUGIN_SRC_DIRS
498 #                       ${PLUGIN_SRC_DIRS}
499 #                       plugins/tpg
500 #               )
501 #       endif()
502 else()
503         set(PLUGIN_SRC_DIRS )
504 endif()
505
506 foreach(PLUGIN_DIR ${PLUGIN_SRC_DIRS})
507         add_subdirectory( ${PLUGIN_DIR} )
508 endforeach()
509
510 add_subdirectory( asn1 EXCLUDE_FROM_ALL )
511 add_subdirectory( codecs )
512 add_subdirectory( epan )
513 add_subdirectory( tools/lemon )
514 add_subdirectory( wiretap )
515 add_subdirectory( wsutil )
516
517 add_custom_target(dumpabi DEPENDS dumpabi-libwireshark dumpabi-libwiretap dumpabi-libwsutil color.h)
518
519 if((BUILD_wireshark AND GTK_FOUND) OR (BUILD_qtshark AND QT_FOUND))
520         add_subdirectory( ui )
521 endif()
522
523 if(BUILD_wireshark AND GTK_FOUND)
524         add_subdirectory( ui/gtk )
525 endif()
526
527 if(BUILD_qtshark AND QT_FOUND)
528         add_subdirectory( ui/qt )
529 endif()
530
531
532 # Basedir where to install guides
533 set(DOC_DIR "$ENV{docdir}" CACHE FILEPATH "Installation directory for ug and dg pdfs.")
534 message(STATUS "docdir: ${DOC_DIR}")
535
536 if(ENABLE_GUIDES)
537         add_subdirectory( docbook )
538 endif()
539
540 if(ENABLE_PCAP_NG_DEFAULT)
541         set(PCAP_NG_DEFAULT 1)
542 endif()
543
544 #Platform specific
545 #if(UNIX)
546 #endif()
547
548 if(APPLE)
549         #
550         # We assume that APPLE means OS X so that we have the OS X
551         # frameworks.
552         #
553         set(HAVE_OS_X_FRAMEWORKS 1)
554         FIND_LIBRARY (APPLE_APPLICATION_SERVICES_LIBRARY ApplicationServices)
555         FIND_LIBRARY (APPLE_CORE_FOUNDATION_LIBRARY CoreFoundation)
556         FIND_LIBRARY (APPLE_SYSTEM_CONFIGURATION_LIBRARY SystemConfiguration)
557 endif()
558
559 if(WIN32)
560         set(WS_MSVC_NORETURN "__declspec(noreturn)")
561
562         # Disable deprecation
563         if(MSVC80 OR MSVC90)
564                 add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
565         endif()
566 else()
567         set(WS_MSVC_NORETURN " ")
568 endif()
569
570 configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h)
571
572 set( configure_input "Built with CMake ${CMAKE_VERSION}" )
573 set( VERSION ${PROJECT_VERSION} )
574
575 configure_file(
576         ${CMAKE_SOURCE_DIR}/packaging/macosx/Info.plist.in
577         ${CMAKE_SOURCE_DIR}/packaging/macosx/Info.plist
578         @ONLY)
579
580 include(FeatureSummary)
581 #SET_FEATURE_INFO(NAME DESCRIPTION [URL [COMMENT] ]
582 #FEATURE_SUMMARY(WHAT ALL) Requires removal of our local copy of FeatureSummary
583 PRINT_ENABLED_FEATURES()
584 PRINT_DISABLED_FEATURES()
585
586 link_directories(
587         ${CMAKE_BINARY_DIR}/ui
588         ${CMAKE_BINARY_DIR}/ui/gtk
589         ${CMAKE_BINARY_DIR}/ui/qt
590         ${CMAKE_BINARY_DIR}/codecs
591         ${CMAKE_BINARY_DIR}/epan
592         ${CMAKE_BINARY_DIR}/wiretap
593         ${CMAKE_BINARY_DIR}/wsutil
594 )
595
596 ADD_CUSTOM_TARGET(
597         svnversion ALL
598         COMMAND ${PERL}
599                 ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
600                 ${CMAKE_CURRENT_SOURCE_DIR}
601         DEPENDS
602                 ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
603 )
604
605 ADD_CUSTOM_COMMAND(
606         OUTPUT  svnversion.h
607         COMMAND ${PERL}
608                 ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
609                 ${CMAKE_CURRENT_SOURCE_DIR}
610         DEPENDS
611                 ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
612 )
613
614 ADD_CUSTOM_COMMAND(
615         OUTPUT  ps.c
616         COMMAND ${PYTHON_EXECUTABLE}
617                 ${CMAKE_CURRENT_SOURCE_DIR}/tools/rdps.py
618                 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
619                 ps.c
620         DEPENDS
621                 ${CMAKE_CURRENT_SOURCE_DIR}/tools/rdps.py
622                 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
623 )
624
625 if(UNIX)
626         set(PLATFORM_SRC
627                 capture-pcap-util-unix.c capture_unix_ifnames.c
628         )
629 endif()
630
631 if(WIN32)
632         set(PLATFORM_SRC
633                 capture-wpcap.c capture_wpcap_packet.c capture_win_ifnames.c
634         )
635 endif()
636
637 set(WTAP_PLUGIN_SOURCES
638         epan/plugins.c
639         epan/report_err.c
640         epan/filesystem.c
641 )
642
643 set(SHARK_COMMON_CAPTURE_SRC
644         capture_ifinfo.c
645         capture_ui_utils.c
646 )
647
648 set(WIRESHARK_COMMON_SRC
649         ${PLATFORM_SRC}
650         capture-pcap-util.c
651         cfile.c
652         cfutils.c
653         clopts_common.c
654         disabled_protos.c
655         frame_data_sequence.c
656         packet-range.c
657         print.c
658         ps.c
659         svnversion.h
660         sync_pipe_write.c
661         timestats.c
662         tap-megaco-common.c
663         tap-rtp-common.c
664         version_info.c
665 )
666
667 set(TSHARK_TAP_SRC
668         ui/cli/tap-afpstat.c
669         ui/cli/tap-ansi_astat.c
670         ui/cli/tap-bootpstat.c
671         ui/cli/tap-camelcounter.c
672         ui/cli/tap-camelsrt.c
673         ui/cli/tap-comparestat.c
674         ui/cli/tap-dcerpcstat.c
675         ui/cli/tap-diameter-avp.c
676         ui/cli/tap-expert.c
677         ui/cli/tap-follow.c
678         ui/cli/tap-funnel.c
679         ui/cli/tap-gsm_astat.c
680         ui/cli/tap-h225counter.c
681         ui/cli/tap-h225rassrt.c
682         ui/cli/tap-hosts.c
683         ui/cli/tap-httpstat.c
684         ui/cli/tap-icmpstat.c
685         ui/cli/tap-icmpv6stat.c
686         ui/cli/tap-iostat.c
687         ui/cli/tap-iousers.c
688         ui/cli/tap-macltestat.c
689         ui/cli/tap-mgcpstat.c
690         ui/cli/tap-megacostat.c
691         ui/cli/tap-protocolinfo.c
692         ui/cli/tap-protohierstat.c
693         ui/cli/tap-radiusstat.c
694         ui/cli/tap-rlcltestat.c
695         ui/cli/tap-rpcstat.c
696         ui/cli/tap-rpcprogs.c
697         ui/cli/tap-rtp.c
698         ui/cli/tap-rtspstat.c
699         ui/cli/tap-scsistat.c
700         ui/cli/tap-sctpchunkstat.c
701         ui/cli/tap-sipstat.c
702         ui/cli/tap-smbsids.c
703         ui/cli/tap-smbstat.c
704         ui/cli/tap-stats_tree.c
705         ui/cli/tap-sv.c
706         ui/cli/tap-wspstat.c
707 )
708
709 set(INSTALL_DIRS
710         diameter
711         dtds
712         help
713         radius
714         tpncp
715         wimaxasncp
716 )
717
718 set(INSTALL_FILES
719         ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
720         COPYING
721         ${CMAKE_BINARY_DIR}/capinfos.html
722         cfilters
723         colorfilters
724         dfilters
725         ${CMAKE_BINARY_DIR}/dftest.html
726         ${CMAKE_BINARY_DIR}/dumpcap.html
727         ${CMAKE_BINARY_DIR}/editcap.html
728         ${CMAKE_BINARY_DIR}/asn2deb.html
729         ${CMAKE_BINARY_DIR}/idl2deb.html
730         ${CMAKE_BINARY_DIR}/idl2wrs.html
731         ipmap.html
732         manuf
733         ${CMAKE_BINARY_DIR}/mergecap.html
734         pdml2html.xsl
735         ${CMAKE_BINARY_DIR}/randpkt.html
736         ${CMAKE_BINARY_DIR}/rawshark.html
737         ${CMAKE_BINARY_DIR}/reordercap.html
738         services
739         smi_modules
740         ${CMAKE_BINARY_DIR}/text2pcap.html
741         ${CMAKE_BINARY_DIR}/tshark.html
742         ${CMAKE_BINARY_DIR}/wireshark-filter.html
743         ${CMAKE_BINARY_DIR}/wireshark.html
744         docbook/ws.css
745 )
746
747 set(LIBEPAN_LIBS
748 #               @NSL_LIBS@      # -lnsl
749 #               @SOCKET_LIBS@   # -lsocket
750 #               @SSL_LIBS@      # -lcrypto
751                 epan
752 #               $(plugin_ldadd) # in case of static
753                 ${PCAP_LIBRARIES}
754                 ${CARES_LIBRARIES}
755                 ${ADNS_LIBRARIES}
756                 ${KERBEROS_LIBRARIES}
757                 ${LUA_LIBRARIES}
758                 ${PYTHON_LIBRARIES}
759                 ${GEOIP_LIBRARIES}
760                 ${GCRYPT_LIBRARIES}
761                 ${GNUTLS_LIBRARIES}
762                 ${SMI_LIBRARIES}
763                 ${ZLIB_LIBRARIES}
764                 ${M_LIBRARIES}
765 )
766
767 if( (BUILD_wireshark AND GTK_FOUND) OR (BUILD_qtshark AND QT_FOUND) )
768         set(wireshark_FILES
769                 airpcap_loader.c
770                 capture.c
771                 capture_info.c
772                 capture_opts.c
773                 capture_sync.c
774                 color_filters.c
775                 file.c
776                 fileset.c
777                 filters.c
778                 g711.c
779                 iface_monitor.c
780                 merge.c
781                 proto_hier_stats.c
782                 summary.c
783                 tempfile.c
784                 u3.c
785                 ws80211_utils.c
786                 ${SHARK_COMMON_CAPTURE_SRC}
787                 ${WIRESHARK_COMMON_SRC}
788         )
789 endif()
790
791 if(BUILD_wireshark AND GTK_FOUND)
792         set(wireshark_LIBS
793                 gtkui
794                 ui
795                 ${GTK2_LIBRARIES}
796                 ${GTK3_LIBRARIES}
797                 ${GTHREAD2_LIBRARIES}
798                 codecs
799                 ${PORTAUDIO_LIBRARIES}
800                 ${LIBEPAN_LIBS}
801                 ${APPLE_APPLICATION_SERVICES_LIBRARY}
802                 ${APPLE_CORE_SERVICES_LIBRARY}
803                 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
804                 ${NL_LIBRARIES}
805         )
806         # qtshark and wireshark share wireshark_FILES
807
808         add_executable(wireshark ${wireshark_FILES})
809         add_dependencies(wireshark svnversion)
810         set_target_properties(wireshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
811         target_link_libraries(wireshark ${wireshark_LIBS})
812         install(TARGETS wireshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
813 endif()
814
815 if(BUILD_qtshark AND QT_FOUND)
816         set(qtshark_LIBS
817                 qtui
818                 ui
819                 ${QT_LIBRARIES}
820                 ${GTHREAD2_LIBRARIES}
821                 codecs
822                 ${PORTAUDIO_LIBRARIES}
823                 ${LIBEPAN_LIBS}
824                 ${APPLE_APPLICATION_SERVICES_LIBRARY}
825                 ${APPLE_CORE_FOUNDATION_LIBRARY}
826                 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
827                 ${NL_LIBRARIES}
828         )
829         # qtshark and wireshark share wireshark_FILES
830
831         add_executable(qtshark ${wireshark_FILES})
832         add_dependencies(qtshark svnversion)
833         set_target_properties(qtshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
834         target_link_libraries(qtshark ${qtshark_LIBS})
835         install(TARGETS qtshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
836 endif()
837
838 register_tap_files(tshark-tap-register.c
839         ${TSHARK_TAP_SRC}
840 )
841
842 if(BUILD_tshark)
843         set(tshark_LIBS
844                 ${LIBEPAN_LIBS}
845                 ${APPLE_CORE_FOUNDATION_LIBRARY}
846                 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
847         )
848         set(tshark_FILES
849                 capture_opts.c
850                 capture_sync.c
851                 tempfile.c
852                 tshark-tap-register.c
853                 tshark.c
854                 ui/util.c
855                 ${TSHARK_TAP_SRC}
856                 ${SHARK_COMMON_CAPTURE_SRC}
857                 ${WIRESHARK_COMMON_SRC}
858         )
859         add_executable(tshark ${tshark_FILES})
860         add_dependencies(tshark svnversion)
861         set_target_properties(tshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
862         target_link_libraries(tshark ${tshark_LIBS})
863         install(TARGETS tshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
864 endif()
865
866 if(BUILD_rawshark AND PCAP_FOUND)
867         set(rawshark_LIBS
868                 ${LIBEPAN_LIBS}
869                 ${APPLE_CORE_FOUNDATION_LIBRARY}
870                 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
871         )
872         set(rawshark_FILES
873                 ${WIRESHARK_COMMON_SRC}
874                 rawshark.c
875                 ui/util.c
876         )
877         add_executable(rawshark ${rawshark_FILES})
878         add_dependencies(rawshark svnversion)
879         set_target_properties(rawshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
880         target_link_libraries(rawshark ${rawshark_LIBS})
881         install(TARGETS rawshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
882 endif()
883
884 if(BUILD_dftest)
885         set(dftest_LIBS
886                 ${LIBEPAN_LIBS}
887         )
888         set(dftest_FILES
889                 dftest.c
890                 ui/util.c
891         )
892         add_executable(dftest ${dftest_FILES})
893         set_target_properties(dftest PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
894         target_link_libraries(dftest ${dftest_LIBS})
895         install(TARGETS dftest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
896 endif()
897
898 if(BUILD_randpkt)
899         set(randpkt_LIBS
900                 wiretap
901                 ${M_LIBRARIES}
902                 ${PCAP_LIBRARIES}
903 #               @SOCKET_LIBS@
904 #               @NSL_LIBS@
905                 ${CARES_LIBRARIES}
906                 ${ADNS_LIBRARIES}
907                 ${ZLIB_LIBRARIES}
908         )
909         set(randpkt_FILES
910                 randpkt.c
911         )
912         add_executable(randpkt ${randpkt_FILES})
913         set_target_properties(randpkt PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
914         target_link_libraries(randpkt ${randpkt_LIBS})
915         install(TARGETS randpkt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
916 endif()
917
918 if(BUILD_text2pcap)
919         set(text2pcap_LIBS
920                 wsutil
921                 ${M_LIBRARIES}
922                 ${ZLIB_LIBRARIES}
923         )
924         set(text2pcap_CLEAN_FILES
925                 text2pcap.c
926                 pcapio.c
927         )
928         set(text2pcap_FILES
929                 ${text2pcap_CLEAN_FILES}
930         )
931         add_lex_files(text2pcap_FILES
932                 text2pcap-scanner.l
933         )
934         add_executable(text2pcap ${text2pcap_FILES})
935         add_dependencies(text2pcap svnversion)
936         set_target_properties(text2pcap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
937         target_link_libraries(text2pcap ${text2pcap_LIBS})
938         install(TARGETS text2pcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
939 endif()
940
941 if(BUILD_mergecap)
942         set(mergecap_LIBS
943                 wiretap
944                 ${ZLIB_LIBRARIES}
945         )
946         set(mergecap_FILES
947                 mergecap.c
948                 merge.c
949                 svnversion.h
950                 ${WTAP_PLUGIN_SOURCES}
951         )
952         add_executable(mergecap ${mergecap_FILES})
953         add_dependencies(mergecap svnversion)
954         set_target_properties(mergecap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
955         target_link_libraries(mergecap ${mergecap_LIBS})
956         install(TARGETS mergecap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
957 endif()
958
959 if(BUILD_reordercap)
960         set(reordercap_LIBS
961                 wiretap
962                 ${ZLIB_LIBRARIES}
963         )
964         set(reordercap_FILES
965                 reordercap.c
966                 svnversion.h
967                 ${WTAP_PLUGIN_SOURCES}
968         )
969         add_executable(reordercap ${reordercap_FILES})
970         add_dependencies(reordercap svnversion)
971         set_target_properties(reordercap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
972         target_link_libraries(reordercap ${reordercap_LIBS})
973         install(TARGETS reordercap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
974 endif()
975
976 if(BUILD_capinfos)
977         set(capinfos_LIBS
978                 wiretap
979                 wsutil
980                 ${ZLIB_LIBRARIES}
981                 ${GCRYPT_LIBRARIES}
982         )
983         set(capinfos_FILES
984                 capinfos.c
985                 ${WTAP_PLUGIN_SOURCES}
986         )
987         add_executable(capinfos ${capinfos_FILES})
988         add_dependencies(capinfos svnversion)
989         set_target_properties(capinfos PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
990         target_link_libraries(capinfos ${capinfos_LIBS})
991         install(TARGETS capinfos RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
992 endif()
993
994 if(BUILD_editcap)
995         set(editcap_LIBS
996                 wiretap
997                 ${ZLIB_LIBRARIES}
998         )
999         set(editcap_FILES
1000                 editcap.c
1001                 epan/crypt/md5.c
1002                 epan/nstime.c
1003                 ${WTAP_PLUGIN_SOURCES}
1004         )
1005         add_executable(editcap ${editcap_FILES})
1006         add_dependencies(editcap svnversion)
1007         set_target_properties(editcap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1008         target_link_libraries(editcap ${editcap_LIBS})
1009         install(TARGETS editcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1010 endif()
1011
1012 if(BUILD_dumpcap AND PCAP_FOUND)
1013         set(dumpcap_LIBS
1014 #               @INET_NTOP_LO@
1015                 wsutil
1016                 ${PCAP_LIBRARIES}
1017                 ${CAP_LIBRARIES}
1018 #               @SOCKET_LIBS@
1019 #               @NSL_LIBS@
1020                 ${GLIB2_LIBRARIES}
1021                 ${GTHREAD2_LIBRARIES}
1022                 ${ZLIB_LIBRARIES}
1023                 ${APPLE_CORE_FOUNDATION_LIBRARY}
1024                 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
1025                 ${NL_LIBRARIES}
1026         )
1027         set(dumpcap_FILES
1028                 svnversion.h
1029                 capture_opts.c
1030                 capture-pcap-util.c
1031                 capture_stop_conditions.c
1032                 cfutils.c
1033                 clopts_common.c
1034                 conditions.c
1035                 dumpcap.c
1036                 pcapio.c
1037                 ringbuffer.c
1038                 sync_pipe_write.c
1039                 tempfile.c
1040                 version_info.c
1041                 ws80211_utils.c
1042                 ${PLATFORM_SRC}
1043         )
1044         add_executable(dumpcap ${dumpcap_FILES})
1045         add_dependencies(dumpcap svnversion)
1046         set_target_properties(dumpcap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1047         target_link_libraries(dumpcap ${dumpcap_LIBS})
1048         install(TARGETS dumpcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1049 endif()
1050
1051 ADD_CUSTOM_COMMAND(
1052         OUTPUT  ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
1053         COMMAND ${PERL}
1054                 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
1055                 ${CMAKE_SOURCE_DIR}/doc/make-authors-short.pl
1056                 < ${CMAKE_SOURCE_DIR}/AUTHORS
1057                 > ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
1058         DEPENDS
1059                 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
1060                 ${CMAKE_SOURCE_DIR}/doc/make-authors-short.pl
1061                 ${CMAKE_SOURCE_DIR}/AUTHORS
1062 )
1063
1064 ADD_CUSTOM_COMMAND(
1065         OUTPUT  ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
1066                 ${CMAKE_BINARY_DIR}/wireshark.pod
1067         COMMAND ${PERL}
1068                 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
1069                 ${CMAKE_SOURCE_DIR}/doc/make-authors-format.pl
1070                 < ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
1071                 > ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
1072         COMMAND cat
1073                 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
1074                 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
1075                 > ${CMAKE_BINARY_DIR}/wireshark.pod
1076         DEPENDS
1077                 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
1078                 ${CMAKE_SOURCE_DIR}/doc/make-authors-format.pl
1079                 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
1080                 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
1081 )
1082
1083 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/capinfos 1 )
1084 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dftest 1 )
1085 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dumpcap 1 )
1086 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/editcap 1 )
1087 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/asn2deb 1 )
1088 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2deb 1 )
1089 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2wrs 1 )
1090 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/mergecap 1 )
1091 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/randpkt 1 )
1092 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/rawshark 1 )
1093 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/reordercap 1 )
1094 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/text2pcap 1 )
1095 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/tshark 1 )
1096 pod2manhtml( wireshark 1 )
1097 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/wireshark-filter 4 )
1098
1099 add_custom_target(
1100         auxiliary ALL
1101         DEPENDS
1102                 AUTHORS-SHORT
1103                 capinfos.html
1104                 dftest.html
1105                 dumpcap.html
1106                 editcap.html
1107                 asn2deb.html
1108                 idl2deb.html
1109                 idl2wrs.html
1110                 mergecap.html
1111                 randpkt.html
1112                 rawshark.html
1113                 reordercap.html
1114                 text2pcap.html
1115                 tshark.html
1116                 wireshark.html
1117                 wireshark-filter.html
1118 )
1119
1120 set(MAN1_FILES
1121         ${CMAKE_BINARY_DIR}/capinfos.1
1122         ${CMAKE_BINARY_DIR}/dftest.1
1123         ${CMAKE_BINARY_DIR}/dumpcap.1
1124         ${CMAKE_BINARY_DIR}/editcap.1
1125         ${CMAKE_BINARY_DIR}/idl2wrs.1
1126         ${CMAKE_BINARY_DIR}/mergecap.1
1127         ${CMAKE_BINARY_DIR}/randpkt.1
1128         ${CMAKE_BINARY_DIR}/rawshark.1
1129         ${CMAKE_BINARY_DIR}/reordercap.1
1130         ${CMAKE_BINARY_DIR}/text2pcap.1
1131         ${CMAKE_BINARY_DIR}/tshark.1
1132         ${CMAKE_BINARY_DIR}/wireshark.1
1133 )
1134
1135 set(MAN4_FILES
1136         ${CMAKE_BINARY_DIR}/wireshark-filter.4
1137 )
1138
1139 set(CLEAN_FILES
1140         ${wireshark_FILES}
1141         ${tshark_FILES}
1142         ${rawshark_FILES}
1143         ${dftest_FILES}
1144         ${randpkt_FILES}
1145         ${text2pcap_CLEAN_FILES}
1146         ${mergecap_FILES}
1147         ${capinfos_FILES}
1148         ${editcap_FILES}
1149         ${dumpcap_FILES}
1150 )
1151
1152 if (WERROR)
1153         set_source_files_properties(
1154                 ${CLEAN_FILES}
1155                 PROPERTIES
1156                 COMPILE_FLAGS -Werror
1157         )
1158 endif()
1159
1160 install(
1161         FILES
1162                 ${INSTALL_FILES}
1163         DESTINATION
1164                 ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
1165 )
1166
1167 install(
1168         FILES
1169                 ${MAN1_FILES}
1170         DESTINATION
1171                 ${CMAKE_INSTALL_MANDIR}/man1
1172 )
1173
1174 install(
1175         FILES
1176                 ${MAN4_FILES}
1177         DESTINATION
1178                 ${CMAKE_INSTALL_MANDIR}/man4
1179 )
1180
1181 install(
1182         DIRECTORY
1183                 ${INSTALL_DIRS}
1184         DIRECTORY_PERMISSIONS
1185                 OWNER_EXECUTE OWNER_WRITE OWNER_READ
1186                 GROUP_EXECUTE GROUP_READ
1187                 WORLD_EXECUTE WORLD_READ
1188         DESTINATION
1189                 ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
1190         PATTERN ".svn" EXCLUDE
1191         PATTERN "Makefile.*" EXCLUDE
1192         PATTERN "faq.py" EXCLUDE
1193 )
1194
1195
1196 if(DOC_DIR)
1197         message(STATUS "Docdir install: ${DOC_DIR}")
1198         INSTALL(
1199                 DIRECTORY
1200                         ${CMAKE_BINARY_DIR}/docbook/
1201                 DIRECTORY_PERMISSIONS
1202                         OWNER_EXECUTE OWNER_WRITE OWNER_READ
1203                         GROUP_EXECUTE GROUP_READ
1204                         WORLD_EXECUTE WORLD_READ
1205                 DESTINATION
1206                         ${DOC_DIR}/guides
1207                 FILES_MATCHING
1208                 PATTERN "*.pdf"
1209         )
1210 endif()