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