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