Sort the list of packages to make it easier to check results.
[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 #Sort the package list
382 list(SORT PACKAGELIST)
383 message(STATUS "Packagelist: ${PACKAGELIST}")
384 #Let's loop the package list
385 foreach(PACKAGE ${PACKAGELIST})
386         if(${PACKAGE} STREQUAL "Qt4")
387                 set(PACKAGE_VAR "QT")
388         elseif(${PACKAGE} STREQUAL "PythonInterp")
389                 set(PACKAGE_VAR "PYTHON")
390         elseif(${PACKAGE} STREQUAL "PythonLibs")
391                 set(PACKAGE_VAR "PYTHON")
392         else()
393                 set(PACKAGE_VAR ${PACKAGE})
394         endif()
395         if(${PACKAGE}_OPTIONS)
396                 find_package(${PACKAGE} ${${PACKAGE}_OPTIONS})
397         elseif(${PACKAGE}_REQUIRED)
398                 find_package(${PACKAGE} REQUIRED)
399         else()
400                 find_package(${PACKAGE})
401         endif()
402         message(${PACKAGE_VAR}_FOUND)
403         if (${PACKAGE_VAR}_FOUND)
404                 set(HAVE_LIB${PACKAGE_VAR} 1)
405                 include_directories(${${PACKAGE_VAR}_INCLUDE_DIRS})
406                 message(STATUS "${PACKAGE} includes: ${${PACKAGE_VAR}_INCLUDE_DIRS}")
407                 message(STATUS "${PACKAGE} libs: ${${PACKAGE_VAR}_LIBRARIES}")
408                 if (${PACKAGE}_DEFINITIONS)
409                         message(STATUS "${PACKAGE} definitions: ${${PACKAGE_VAR}_DEFINITIONS}")
410                 endif()
411                 if (${PACKAGE_VAR}_EXECUTABLE)
412                         message(STATUS "${PACKAGE} executable: ${${PACKAGE_VAR}_EXECUTABLE}")
413                 endif()
414         endif()
415 endforeach()
416
417 #packaging
418 include(CPackConfig.txt)
419
420 if(HAVE_LIBPYTHON)
421         set(HAVE_PYTHON 1)
422         set(PYTHON_DIR "${CMAKE_INSTALL_PREFIX}/lib/wireshark/python/${CPACK_PACKAGE_VERSION}")
423 endif()
424 if(HAVE_LIBLUA)
425         set(HAVE_LUA_H 1)
426         set(HAVE_LUA 1)
427 endif()
428 if(HAVE_LIBKERBEROS)
429         set(HAVE_KERBEROS 1)
430         # HAVE_HEIMDAL_KERBEROS
431         set(HAVE_MIT_KERBEROS 1)
432         set(HAVE_KEYTYPE_ARCFOUR_56 1)
433 endif()
434 if(HAVE_LIBGEOIP)
435         set(HAVE_GEOIP 1)
436 endif()
437 if(HAVE_LIBCARES)
438         set(HAVE_C_ARES 1)
439 endif()
440 if(HAVE_LIBADNS)
441         set(HAVE_GNU_ADNS 1)
442 endif()
443 if(ENABLE_AIRPCAP)
444         set(HAVE_AIRPCAP 1)
445 endif()
446 if(HAVE_LIBNL AND ENABLE_AIRPCAP)
447         message(ERROR "Airpcap and Libnl support are mutually exclusive")
448 endif()
449 # No matter which version of GTK is present
450 if(GTK2_FOUND OR GTK3_FOUND)
451         set(GTK_FOUND ON)
452 endif()
453 # That's the name autofoo uses
454 if(HAVE_LIBZLIB)
455         set(HAVE_LIBZ 1)
456 endif()
457 if (Qt5Widgets_FOUND)
458         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
459         if (Qt5_POSITION_INDEPENDENT_CODE)
460                 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
461         endif()
462         set (QT_FOUND ON)
463         set (QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES})
464 # If Qt4: QT_LIBRARIES and QT_INCLUDES are not set above. They require extra magic
465 elseif(QT_FOUND)
466         include(${QT_USE_FILE})
467         include_directories(${QT_INCLUDE_DIR})
468         message(STATUS "QT includes: ${QT_INCLUDE_DIR}")
469         message(STATUS "QT libs: ${QT_LIBRARIES}")
470 endif()
471 include(ConfigureChecks.cmake)
472
473 #Big or little endian ?
474 include(TestBigEndian)
475 test_big_endian(WORDS_BIGENDIAN)
476
477 set(DATAFILE_DIR "${CMAKE_INSTALL_PREFIX}/share/${CPACK_PACKAGE_NAME}")
478
479 if(ENABLE_PLUGINS)
480         set(HAVE_PLUGINS 1)
481         set(PLUGIN_DIR="${DATAFILE_DIR}/plugins/${CPACK_PACKAGE_VERSION}")
482         set(PLUGIN_SRC_DIRS
483                 plugins/asn1
484                 plugins/docsis
485                 plugins/ethercat
486                 plugins/gryphon
487                 plugins/irda
488                 plugins/m2m
489                 plugins/mate
490                 plugins/opcua
491                 plugins/profinet
492                 plugins/stats_tree
493                 plugins/unistim
494                 plugins/wimax
495                 plugins/wimaxasncp
496                 plugins/wimaxmacphy
497         )
498 # It seems this stuff doesn't build with autofoo either...
499 #       if(YAPP_FOUND)
500 #               set(PLUGIN_SRC_DIRS
501 #                       ${PLUGIN_SRC_DIRS}
502 #                       plugins/tpg
503 #               )
504 #       endif()
505 else()
506         set(PLUGIN_SRC_DIRS )
507 endif()
508
509 foreach(PLUGIN_DIR ${PLUGIN_SRC_DIRS})
510         add_subdirectory( ${PLUGIN_DIR} )
511 endforeach()
512
513 add_subdirectory( asn1 EXCLUDE_FROM_ALL )
514 add_subdirectory( codecs )
515 add_subdirectory( epan )
516 add_subdirectory( tools/lemon )
517 add_subdirectory( wiretap )
518 add_subdirectory( wsutil )
519
520 add_custom_target(dumpabi DEPENDS dumpabi-libwireshark dumpabi-libwiretap dumpabi-libwsutil color.h)
521
522 if((BUILD_wireshark AND GTK_FOUND) OR (BUILD_qtshark AND QT_FOUND))
523         add_subdirectory( ui )
524 endif()
525
526 if(BUILD_wireshark AND GTK_FOUND)
527         add_subdirectory( ui/gtk )
528 endif()
529
530 if(BUILD_qtshark AND QT_FOUND)
531         add_subdirectory( ui/qt )
532 endif()
533
534
535 # Basedir where to install guides
536 set(DOC_DIR "$ENV{docdir}" CACHE FILEPATH "Installation directory for ug and dg pdfs.")
537 message(STATUS "docdir: ${DOC_DIR}")
538
539 if(ENABLE_GUIDES)
540         add_subdirectory( docbook )
541 endif()
542
543 if(ENABLE_PCAP_NG_DEFAULT)
544         set(PCAP_NG_DEFAULT 1)
545 endif()
546
547 #Platform specific
548 #if(UNIX)
549 #endif()
550
551 if(APPLE)
552         #
553         # We assume that APPLE means OS X so that we have the OS X
554         # frameworks.
555         #
556         set(HAVE_OS_X_FRAMEWORKS 1)
557         FIND_LIBRARY (APPLE_APPLICATION_SERVICES_LIBRARY ApplicationServices)
558         FIND_LIBRARY (APPLE_CORE_FOUNDATION_LIBRARY CoreFoundation)
559         FIND_LIBRARY (APPLE_SYSTEM_CONFIGURATION_LIBRARY SystemConfiguration)
560 endif()
561
562 if(WIN32)
563         set(WS_MSVC_NORETURN "__declspec(noreturn)")
564
565         # Disable deprecation
566         if(MSVC80 OR MSVC90)
567                 add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
568         endif()
569 else()
570         set(WS_MSVC_NORETURN " ")
571 endif()
572
573 configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h)
574
575 set( configure_input "Built with CMake ${CMAKE_VERSION}" )
576 set( VERSION ${PROJECT_VERSION} )
577
578 configure_file(
579         ${CMAKE_SOURCE_DIR}/packaging/macosx/Info.plist.in
580         ${CMAKE_SOURCE_DIR}/packaging/macosx/Info.plist
581         @ONLY)
582
583 include(FeatureSummary)
584 #SET_FEATURE_INFO(NAME DESCRIPTION [URL [COMMENT] ]
585 #FEATURE_SUMMARY(WHAT ALL) Requires removal of our local copy of FeatureSummary
586 PRINT_ENABLED_FEATURES()
587 PRINT_DISABLED_FEATURES()
588
589 link_directories(
590         ${CMAKE_BINARY_DIR}/ui
591         ${CMAKE_BINARY_DIR}/ui/gtk
592         ${CMAKE_BINARY_DIR}/ui/qt
593         ${CMAKE_BINARY_DIR}/codecs
594         ${CMAKE_BINARY_DIR}/epan
595         ${CMAKE_BINARY_DIR}/wiretap
596         ${CMAKE_BINARY_DIR}/wsutil
597 )
598
599 ADD_CUSTOM_TARGET(
600         svnversion ALL
601         COMMAND ${PERL}
602                 ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
603                 ${CMAKE_CURRENT_SOURCE_DIR}
604         DEPENDS
605                 ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
606 )
607
608 ADD_CUSTOM_COMMAND(
609         OUTPUT  svnversion.h
610         COMMAND ${PERL}
611                 ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
612                 ${CMAKE_CURRENT_SOURCE_DIR}
613         DEPENDS
614                 ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
615 )
616
617 ADD_CUSTOM_COMMAND(
618         OUTPUT  ps.c
619         COMMAND ${PYTHON_EXECUTABLE}
620                 ${CMAKE_CURRENT_SOURCE_DIR}/tools/rdps.py
621                 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
622                 ps.c
623         DEPENDS
624                 ${CMAKE_CURRENT_SOURCE_DIR}/tools/rdps.py
625                 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
626 )
627
628 if(UNIX)
629         set(PLATFORM_SRC
630                 capture-pcap-util-unix.c capture_unix_ifnames.c
631         )
632 endif()
633
634 if(WIN32)
635         set(PLATFORM_SRC
636                 capture-wpcap.c capture_wpcap_packet.c capture_win_ifnames.c
637         )
638 endif()
639
640 set(WTAP_PLUGIN_SOURCES
641         epan/plugins.c
642         epan/report_err.c
643         epan/filesystem.c
644 )
645
646 set(SHARK_COMMON_CAPTURE_SRC
647         capture_ifinfo.c
648         capture_ui_utils.c
649 )
650
651 set(WIRESHARK_COMMON_SRC
652         ${PLATFORM_SRC}
653         capture-pcap-util.c
654         cfile.c
655         cfutils.c
656         clopts_common.c
657         disabled_protos.c
658         frame_data_sequence.c
659         packet-range.c
660         print.c
661         ps.c
662         svnversion.h
663         sync_pipe_write.c
664         timestats.c
665         tap-megaco-common.c
666         tap-rtp-common.c
667         version_info.c
668 )
669
670 set(TSHARK_TAP_SRC
671         ui/cli/tap-afpstat.c
672         ui/cli/tap-ansi_astat.c
673         ui/cli/tap-bootpstat.c
674         ui/cli/tap-camelcounter.c
675         ui/cli/tap-camelsrt.c
676         ui/cli/tap-comparestat.c
677         ui/cli/tap-dcerpcstat.c
678         ui/cli/tap-diameter-avp.c
679         ui/cli/tap-expert.c
680         ui/cli/tap-follow.c
681         ui/cli/tap-funnel.c
682         ui/cli/tap-gsm_astat.c
683         ui/cli/tap-h225counter.c
684         ui/cli/tap-h225rassrt.c
685         ui/cli/tap-hosts.c
686         ui/cli/tap-httpstat.c
687         ui/cli/tap-icmpstat.c
688         ui/cli/tap-icmpv6stat.c
689         ui/cli/tap-iostat.c
690         ui/cli/tap-iousers.c
691         ui/cli/tap-macltestat.c
692         ui/cli/tap-mgcpstat.c
693         ui/cli/tap-megacostat.c
694         ui/cli/tap-protocolinfo.c
695         ui/cli/tap-protohierstat.c
696         ui/cli/tap-radiusstat.c
697         ui/cli/tap-rlcltestat.c
698         ui/cli/tap-rpcstat.c
699         ui/cli/tap-rpcprogs.c
700         ui/cli/tap-rtp.c
701         ui/cli/tap-rtspstat.c
702         ui/cli/tap-scsistat.c
703         ui/cli/tap-sctpchunkstat.c
704         ui/cli/tap-sipstat.c
705         ui/cli/tap-smbsids.c
706         ui/cli/tap-smbstat.c
707         ui/cli/tap-stats_tree.c
708         ui/cli/tap-sv.c
709         ui/cli/tap-wspstat.c
710 )
711
712 set(INSTALL_DIRS
713         diameter
714         dtds
715         help
716         radius
717         tpncp
718         wimaxasncp
719 )
720
721 set(INSTALL_FILES
722         ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
723         COPYING
724         ${CMAKE_BINARY_DIR}/capinfos.html
725         cfilters
726         colorfilters
727         dfilters
728         ${CMAKE_BINARY_DIR}/dftest.html
729         ${CMAKE_BINARY_DIR}/dumpcap.html
730         ${CMAKE_BINARY_DIR}/editcap.html
731         ${CMAKE_BINARY_DIR}/asn2deb.html
732         ${CMAKE_BINARY_DIR}/idl2deb.html
733         ${CMAKE_BINARY_DIR}/idl2wrs.html
734         ipmap.html
735         manuf
736         ${CMAKE_BINARY_DIR}/mergecap.html
737         pdml2html.xsl
738         ${CMAKE_BINARY_DIR}/randpkt.html
739         ${CMAKE_BINARY_DIR}/rawshark.html
740         ${CMAKE_BINARY_DIR}/reordercap.html
741         services
742         smi_modules
743         ${CMAKE_BINARY_DIR}/text2pcap.html
744         ${CMAKE_BINARY_DIR}/tshark.html
745         ${CMAKE_BINARY_DIR}/wireshark-filter.html
746         ${CMAKE_BINARY_DIR}/wireshark.html
747         docbook/ws.css
748 )
749
750 set(LIBEPAN_LIBS
751 #               @NSL_LIBS@      # -lnsl
752 #               @SOCKET_LIBS@   # -lsocket
753 #               @SSL_LIBS@      # -lcrypto
754                 epan
755 #               $(plugin_ldadd) # in case of static
756                 ${PCAP_LIBRARIES}
757                 ${CARES_LIBRARIES}
758                 ${ADNS_LIBRARIES}
759                 ${KERBEROS_LIBRARIES}
760                 ${LUA_LIBRARIES}
761                 ${PYTHON_LIBRARIES}
762                 ${GEOIP_LIBRARIES}
763                 ${GCRYPT_LIBRARIES}
764                 ${GNUTLS_LIBRARIES}
765                 ${SMI_LIBRARIES}
766                 ${ZLIB_LIBRARIES}
767                 ${M_LIBRARIES}
768 )
769
770 if( (BUILD_wireshark AND GTK_FOUND) OR (BUILD_qtshark AND QT_FOUND) )
771         set(wireshark_FILES
772                 airpcap_loader.c
773                 capture.c
774                 capture_info.c
775                 capture_opts.c
776                 capture_sync.c
777                 color_filters.c
778                 file.c
779                 fileset.c
780                 filters.c
781                 g711.c
782                 iface_monitor.c
783                 merge.c
784                 proto_hier_stats.c
785                 summary.c
786                 tempfile.c
787                 u3.c
788                 ws80211_utils.c
789                 ${SHARK_COMMON_CAPTURE_SRC}
790                 ${WIRESHARK_COMMON_SRC}
791         )
792 endif()
793
794 if(BUILD_wireshark AND GTK_FOUND)
795         set(wireshark_LIBS
796                 gtkui
797                 ui
798                 ${GTK2_LIBRARIES}
799                 ${GTK3_LIBRARIES}
800                 ${GTHREAD2_LIBRARIES}
801                 codecs
802                 ${PORTAUDIO_LIBRARIES}
803                 ${LIBEPAN_LIBS}
804                 ${APPLE_APPLICATION_SERVICES_LIBRARY}
805                 ${APPLE_CORE_SERVICES_LIBRARY}
806                 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
807                 ${NL_LIBRARIES}
808         )
809         # qtshark and wireshark share wireshark_FILES
810
811         add_executable(wireshark ${wireshark_FILES})
812         add_dependencies(wireshark svnversion)
813         set_target_properties(wireshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
814         target_link_libraries(wireshark ${wireshark_LIBS})
815         install(TARGETS wireshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
816 endif()
817
818 if(BUILD_qtshark AND QT_FOUND)
819         set(qtshark_LIBS
820                 qtui
821                 ui
822                 ${QT_LIBRARIES}
823                 ${GTHREAD2_LIBRARIES}
824                 codecs
825                 ${PORTAUDIO_LIBRARIES}
826                 ${LIBEPAN_LIBS}
827                 ${APPLE_APPLICATION_SERVICES_LIBRARY}
828                 ${APPLE_CORE_FOUNDATION_LIBRARY}
829                 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
830                 ${NL_LIBRARIES}
831         )
832         # qtshark and wireshark share wireshark_FILES
833
834         add_executable(qtshark ${wireshark_FILES})
835         add_dependencies(qtshark svnversion)
836         set_target_properties(qtshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
837         target_link_libraries(qtshark ${qtshark_LIBS})
838         install(TARGETS qtshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
839 endif()
840
841 register_tap_files(tshark-tap-register.c
842         ${TSHARK_TAP_SRC}
843 )
844
845 if(BUILD_tshark)
846         set(tshark_LIBS
847                 ${LIBEPAN_LIBS}
848                 ${APPLE_CORE_FOUNDATION_LIBRARY}
849                 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
850         )
851         set(tshark_FILES
852                 capture_opts.c
853                 capture_sync.c
854                 tempfile.c
855                 tshark-tap-register.c
856                 tshark.c
857                 ui/util.c
858                 ${TSHARK_TAP_SRC}
859                 ${SHARK_COMMON_CAPTURE_SRC}
860                 ${WIRESHARK_COMMON_SRC}
861         )
862         add_executable(tshark ${tshark_FILES})
863         add_dependencies(tshark svnversion)
864         set_target_properties(tshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
865         target_link_libraries(tshark ${tshark_LIBS})
866         install(TARGETS tshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
867 endif()
868
869 if(BUILD_rawshark AND PCAP_FOUND)
870         set(rawshark_LIBS
871                 ${LIBEPAN_LIBS}
872                 ${APPLE_CORE_FOUNDATION_LIBRARY}
873                 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
874         )
875         set(rawshark_FILES
876                 ${WIRESHARK_COMMON_SRC}
877                 rawshark.c
878                 ui/util.c
879         )
880         add_executable(rawshark ${rawshark_FILES})
881         add_dependencies(rawshark svnversion)
882         set_target_properties(rawshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
883         target_link_libraries(rawshark ${rawshark_LIBS})
884         install(TARGETS rawshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
885 endif()
886
887 if(BUILD_dftest)
888         set(dftest_LIBS
889                 ${LIBEPAN_LIBS}
890         )
891         set(dftest_FILES
892                 dftest.c
893                 ui/util.c
894         )
895         add_executable(dftest ${dftest_FILES})
896         set_target_properties(dftest PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
897         target_link_libraries(dftest ${dftest_LIBS})
898         install(TARGETS dftest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
899 endif()
900
901 if(BUILD_randpkt)
902         set(randpkt_LIBS
903                 wiretap
904                 ${M_LIBRARIES}
905                 ${PCAP_LIBRARIES}
906 #               @SOCKET_LIBS@
907 #               @NSL_LIBS@
908                 ${CARES_LIBRARIES}
909                 ${ADNS_LIBRARIES}
910                 ${ZLIB_LIBRARIES}
911         )
912         set(randpkt_FILES
913                 randpkt.c
914         )
915         add_executable(randpkt ${randpkt_FILES})
916         set_target_properties(randpkt PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
917         target_link_libraries(randpkt ${randpkt_LIBS})
918         install(TARGETS randpkt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
919 endif()
920
921 if(BUILD_text2pcap)
922         set(text2pcap_LIBS
923                 wsutil
924                 ${M_LIBRARIES}
925                 ${ZLIB_LIBRARIES}
926         )
927         set(text2pcap_CLEAN_FILES
928                 text2pcap.c
929                 pcapio.c
930         )
931         set(text2pcap_FILES
932                 ${text2pcap_CLEAN_FILES}
933         )
934         add_lex_files(text2pcap_FILES
935                 text2pcap-scanner.l
936         )
937         add_executable(text2pcap ${text2pcap_FILES})
938         add_dependencies(text2pcap svnversion)
939         set_target_properties(text2pcap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
940         target_link_libraries(text2pcap ${text2pcap_LIBS})
941         install(TARGETS text2pcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
942 endif()
943
944 if(BUILD_mergecap)
945         set(mergecap_LIBS
946                 wiretap
947                 ${ZLIB_LIBRARIES}
948         )
949         set(mergecap_FILES
950                 mergecap.c
951                 merge.c
952                 svnversion.h
953                 ${WTAP_PLUGIN_SOURCES}
954         )
955         add_executable(mergecap ${mergecap_FILES})
956         add_dependencies(mergecap svnversion)
957         set_target_properties(mergecap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
958         target_link_libraries(mergecap ${mergecap_LIBS})
959         install(TARGETS mergecap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
960 endif()
961
962 if(BUILD_reordercap)
963         set(reordercap_LIBS
964                 wiretap
965                 ${ZLIB_LIBRARIES}
966         )
967         set(reordercap_FILES
968                 reordercap.c
969                 svnversion.h
970                 ${WTAP_PLUGIN_SOURCES}
971         )
972         add_executable(reordercap ${reordercap_FILES})
973         add_dependencies(reordercap svnversion)
974         set_target_properties(reordercap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
975         target_link_libraries(reordercap ${reordercap_LIBS})
976         install(TARGETS reordercap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
977 endif()
978
979 if(BUILD_capinfos)
980         set(capinfos_LIBS
981                 wiretap
982                 wsutil
983                 ${ZLIB_LIBRARIES}
984                 ${GCRYPT_LIBRARIES}
985         )
986         set(capinfos_FILES
987                 capinfos.c
988                 ${WTAP_PLUGIN_SOURCES}
989         )
990         add_executable(capinfos ${capinfos_FILES})
991         add_dependencies(capinfos svnversion)
992         set_target_properties(capinfos PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
993         target_link_libraries(capinfos ${capinfos_LIBS})
994         install(TARGETS capinfos RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
995 endif()
996
997 if(BUILD_editcap)
998         set(editcap_LIBS
999                 wiretap
1000                 ${ZLIB_LIBRARIES}
1001         )
1002         set(editcap_FILES
1003                 editcap.c
1004                 epan/crypt/md5.c
1005                 epan/nstime.c
1006                 ${WTAP_PLUGIN_SOURCES}
1007         )
1008         add_executable(editcap ${editcap_FILES})
1009         add_dependencies(editcap svnversion)
1010         set_target_properties(editcap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1011         target_link_libraries(editcap ${editcap_LIBS})
1012         install(TARGETS editcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1013 endif()
1014
1015 if(BUILD_dumpcap AND PCAP_FOUND)
1016         set(dumpcap_LIBS
1017 #               @INET_NTOP_LO@
1018                 wsutil
1019                 ${PCAP_LIBRARIES}
1020                 ${CAP_LIBRARIES}
1021 #               @SOCKET_LIBS@
1022 #               @NSL_LIBS@
1023                 ${GLIB2_LIBRARIES}
1024                 ${GTHREAD2_LIBRARIES}
1025                 ${ZLIB_LIBRARIES}
1026                 ${APPLE_CORE_FOUNDATION_LIBRARY}
1027                 ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
1028                 ${NL_LIBRARIES}
1029         )
1030         set(dumpcap_FILES
1031                 svnversion.h
1032                 capture_opts.c
1033                 capture-pcap-util.c
1034                 capture_stop_conditions.c
1035                 cfutils.c
1036                 clopts_common.c
1037                 conditions.c
1038                 dumpcap.c
1039                 pcapio.c
1040                 ringbuffer.c
1041                 sync_pipe_write.c
1042                 tempfile.c
1043                 version_info.c
1044                 ws80211_utils.c
1045                 ${PLATFORM_SRC}
1046         )
1047         add_executable(dumpcap ${dumpcap_FILES})
1048         add_dependencies(dumpcap svnversion)
1049         set_target_properties(dumpcap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
1050         target_link_libraries(dumpcap ${dumpcap_LIBS})
1051         install(TARGETS dumpcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
1052 endif()
1053
1054 ADD_CUSTOM_COMMAND(
1055         OUTPUT  ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
1056         COMMAND ${PERL}
1057                 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
1058                 ${CMAKE_SOURCE_DIR}/doc/make-authors-short.pl
1059                 < ${CMAKE_SOURCE_DIR}/AUTHORS
1060                 > ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
1061         DEPENDS
1062                 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
1063                 ${CMAKE_SOURCE_DIR}/doc/make-authors-short.pl
1064                 ${CMAKE_SOURCE_DIR}/AUTHORS
1065 )
1066
1067 ADD_CUSTOM_COMMAND(
1068         OUTPUT  ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
1069                 ${CMAKE_BINARY_DIR}/wireshark.pod
1070         COMMAND ${PERL}
1071                 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
1072                 ${CMAKE_SOURCE_DIR}/doc/make-authors-format.pl
1073                 < ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
1074                 > ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
1075         COMMAND cat
1076                 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
1077                 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT-FORMAT
1078                 > ${CMAKE_BINARY_DIR}/wireshark.pod
1079         DEPENDS
1080                 ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
1081                 ${CMAKE_SOURCE_DIR}/doc/make-authors-format.pl
1082                 ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
1083                 ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
1084 )
1085
1086 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/capinfos 1 )
1087 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dftest 1 )
1088 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dumpcap 1 )
1089 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/editcap 1 )
1090 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/asn2deb 1 )
1091 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2deb 1 )
1092 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2wrs 1 )
1093 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/mergecap 1 )
1094 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/randpkt 1 )
1095 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/rawshark 1 )
1096 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/reordercap 1 )
1097 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/text2pcap 1 )
1098 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/tshark 1 )
1099 pod2manhtml( wireshark 1 )
1100 pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/wireshark-filter 4 )
1101
1102 add_custom_target(
1103         auxiliary ALL
1104         DEPENDS
1105                 AUTHORS-SHORT
1106                 capinfos.html
1107                 dftest.html
1108                 dumpcap.html
1109                 editcap.html
1110                 asn2deb.html
1111                 idl2deb.html
1112                 idl2wrs.html
1113                 mergecap.html
1114                 randpkt.html
1115                 rawshark.html
1116                 reordercap.html
1117                 text2pcap.html
1118                 tshark.html
1119                 wireshark.html
1120                 wireshark-filter.html
1121 )
1122
1123 set(MAN1_FILES
1124         ${CMAKE_BINARY_DIR}/capinfos.1
1125         ${CMAKE_BINARY_DIR}/dftest.1
1126         ${CMAKE_BINARY_DIR}/dumpcap.1
1127         ${CMAKE_BINARY_DIR}/editcap.1
1128         ${CMAKE_BINARY_DIR}/idl2wrs.1
1129         ${CMAKE_BINARY_DIR}/mergecap.1
1130         ${CMAKE_BINARY_DIR}/randpkt.1
1131         ${CMAKE_BINARY_DIR}/rawshark.1
1132         ${CMAKE_BINARY_DIR}/reordercap.1
1133         ${CMAKE_BINARY_DIR}/text2pcap.1
1134         ${CMAKE_BINARY_DIR}/tshark.1
1135         ${CMAKE_BINARY_DIR}/wireshark.1
1136 )
1137
1138 set(MAN4_FILES
1139         ${CMAKE_BINARY_DIR}/wireshark-filter.4
1140 )
1141
1142 set(CLEAN_FILES
1143         ${wireshark_FILES}
1144         ${tshark_FILES}
1145         ${rawshark_FILES}
1146         ${dftest_FILES}
1147         ${randpkt_FILES}
1148         ${text2pcap_CLEAN_FILES}
1149         ${mergecap_FILES}
1150         ${capinfos_FILES}
1151         ${editcap_FILES}
1152         ${dumpcap_FILES}
1153 )
1154
1155 if (WERROR)
1156         set_source_files_properties(
1157                 ${CLEAN_FILES}
1158                 PROPERTIES
1159                 COMPILE_FLAGS -Werror
1160         )
1161 endif()
1162
1163 install(
1164         FILES
1165                 ${INSTALL_FILES}
1166         DESTINATION
1167                 ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
1168 )
1169
1170 install(
1171         FILES
1172                 ${MAN1_FILES}
1173         DESTINATION
1174                 ${CMAKE_INSTALL_MANDIR}/man1
1175 )
1176
1177 install(
1178         FILES
1179                 ${MAN4_FILES}
1180         DESTINATION
1181                 ${CMAKE_INSTALL_MANDIR}/man4
1182 )
1183
1184 install(
1185         DIRECTORY
1186                 ${INSTALL_DIRS}
1187         DIRECTORY_PERMISSIONS
1188                 OWNER_EXECUTE OWNER_WRITE OWNER_READ
1189                 GROUP_EXECUTE GROUP_READ
1190                 WORLD_EXECUTE WORLD_READ
1191         DESTINATION
1192                 ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
1193         PATTERN ".svn" EXCLUDE
1194         PATTERN "Makefile.*" EXCLUDE
1195         PATTERN "faq.py" EXCLUDE
1196 )
1197
1198
1199 if(DOC_DIR)
1200         message(STATUS "Docdir install: ${DOC_DIR}")
1201         INSTALL(
1202                 DIRECTORY
1203                         ${CMAKE_BINARY_DIR}/docbook/
1204                 DIRECTORY_PERMISSIONS
1205                         OWNER_EXECUTE OWNER_WRITE OWNER_READ
1206                         GROUP_EXECUTE GROUP_READ
1207                         WORLD_EXECUTE WORLD_READ
1208                 DESTINATION
1209                         ${DOC_DIR}/guides
1210                 FILES_MATCHING
1211                 PATTERN "*.pdf"
1212         )
1213 endif()