Move a couple of time-related modules into wsutil.
[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         -Wcast-align
128         -Wformat-security
129         -Wshorten-64-to-32
130         -Wvla
131         -Waddress
132         -Warray-bounds
133         -Wattributes
134         -Wdiv-by-zero
135         -Wignored-qualifiers
136         -Wpragmas
137         -Wno-overlength-strings
138         -Wwrite-strings
139         -Wno-long-long
140 )
141 if (NOT APPLE)
142         set(WIRESHARK_C_FLAGS ${WIRESHARK_C_FLAGS} -fexcess-precision=fast)
143 endif()
144
145 set(WIRESHARK_C_ONLY_FLAGS
146         # The following are C only, not C++
147         -Wc++-compat
148         -Wdeclaration-after-statement
149         -Wlogical-op
150         -Wshadow
151         -Wno-pointer-sign
152         -Wold-style-definition
153         -Wshadow
154         -Wstrict-prototypes
155         -Wjump-misses-init
156 )
157
158 set(WIRESHARK_EXTRA_C_FLAGS
159         -pedantic
160         -Woverflow
161         -fstrict-overflow -Wstrict-overflow=4
162         -Wunreachable-code
163         -Wunsafe-loop-optimizations
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         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()