If something is only supposed to be included if we have libpcap, don't
[obnox/wireshark/wip.git] / CMakeLists.txt
index 9dcd81dc4c02d8b236db2c6be7281607a7d610a8..e30a8a52ef919b89a4c16d7b38816da6c13d838e 100644 (file)
 project(Wireshark C)
 
 cmake_minimum_required(VERSION 2.6)
+set(CMAKE_BACKWARDS_COMPATIBILITY 2.6)
+
+# set(PROJECT_VERSION "1.3.4-rc5")
+# set(PROJECT_VERSION "1.3.4rc5")
+# set(PROJECT_VERSION "1.3.4")
+# If not set, copy over Wireshark version from configure.in AC_INIT
+if(NOT PROJECT_VERSION)
+       file(STRINGS
+               ${CMAKE_SOURCE_DIR}/configure.in
+               VERSIONLINE
+               REGEX "\\(wireshark, .*\\)"
+       )
+       string(REGEX REPLACE ".*\\(wireshark, (.*)\\).*"
+               "\\1"
+               PROJECT_VERSION
+               ${VERSIONLINE}
+       )
+endif()
+string(REGEX REPLACE "([0-9]+)\\..*"
+       "\\1"
+       PROJECT_MAJOR_VERSION
+       ${PROJECT_VERSION}
+)
+string(REGEX REPLACE ".*\\.([0-9]+)\\..*"
+       "\\1"
+       PROJECT_MINOR_VERSION
+       ${PROJECT_VERSION}
+)
+string(REGEX REPLACE ".*\\..*\\.([0-9]+).*"
+       "\\1"
+       PROJECT_PATCH_VERSION
+       ${PROJECT_VERSION}
+)
+string(REGEX REPLACE ".*\\..*\\.[0-9]+(.*)"
+       "\\1"
+       PROJECT_VERSION_EXTENSION
+       ${PROJECT_VERSION}
+)
+message(STATUS "V: ${PROJECT_VERSION}, MaV: ${PROJECT_MAJOR_VERSION}, MiV: ${PROJECT_MINOR_VERSION}, PL: ${PROJECT_PATCH_VERSION}, EV: ${PROJECT_VERSION_EXTENSION}.")
 
 #Where to find local cmake scripts
 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
@@ -36,8 +75,6 @@ INCLUDE(UseMakeTapReg)
 # Disable this later. Alternative: "make VERBOSE=1"
 set(CMAKE_VERBOSE_MAKEFILE ON)
 
-set(BUILD_SHARED_LIBS ON)
-
 #Defines CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_DATADIR, etc ...
 include(CMakeInstallDirs)
 
@@ -72,13 +109,15 @@ option(DISABLE_WERROR       "Do not treat Warnings as errors" OFF)
 option(ENABLE_EXTRA_GCC_CHECKS "Do additional -W checks in GCC (disables -Werror)" OFF)
 option(ENABLE_AIRPCAP   "Enable Airpcap support" ON)
 # todo
-option(ENABLE_STATIC     "Build a static version of Wireshark" OFF)
+option(ENABLE_STATIC     "Build a static version of Wireshark (not yet working)" OFF)
 option(ENABLE_PLUGINS    "Build with plugins" ON)
+# todo
+option(ENABLE_GUIDES     "Build Guides" ON)
 
 option(ENABLE_ADNS       "Build with adns support" ON)
 option(ENABLE_PCRE       "Build with pcre support" ON)
 option(ENABLE_PORTAUDIO  "Build with portaudio support" ON)
-option(ENABLE_Z          "Build with zlib compression support" ON)
+option(ENABLE_ZLIB       "Build with zlib compression support" ON)
 option(ENABLE_LUA       "Build with lua dissector support" ON)
 option(ENABLE_PYTHON    "Build with python dissector support" ON)
 option(ENABLE_SMI       "Build with smi snmp support" ON)
@@ -137,7 +176,7 @@ set(WIRESHARK_EXTRA_C_FLAGS
        -Wshorten-64-to-32
 )
 
-if(ENABLE_EXTRA_GCC_CHECKS)
+if(ENABLE_EXTRA_GCC_CHECKS)   # This overrides -Werror
        set(WIRESHARK_C_FLAGS ${WIRESHARK_C_FLAGS} ${WIRESHARK_EXTRA_C_FLAGS})
 endif()
 
@@ -164,6 +203,8 @@ endforeach()
 
 if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_GCC_CHECKS)
        check_c_compiler_flag(-Werror WERROR)
+else()
+       set(WERROR 0)
 endif()
 
 if(CMAKE_COMPILER_IS_GNUCC)
@@ -172,13 +213,34 @@ else()
        add_definitions( -D_U_=\"\" )
 endif()
 
-# todo
-# Same for linker flags, but it looks like it's do-it-yourself here
-# AC_WIRESHARK_GCC_LDFLAGS_CHECK([-Wl,--as-needed])
-# AC_WIRESHARK_GCC_LDFLAGS_CHECK([-flto])
-# AC_WIRESHARK_GCC_LDFLAGS_CHECK([-fwhopr])
-# AC_WIRESHARK_GCC_LDFLAGS_CHECK([-fwhole-program])
+set(WIRESHARK_LD_FLAGS
+       -Wl,--as-needed
+       # -flto
+       # -fwhopr
+       # -fwhole-program
+)
+
+include(CheckCLinkerFlag)
+set(C 0)
+# Sigh: Have to use THIS_FLAG instead of ${F} for some reason
+foreach(THIS_FLAG ${WIRESHARK_LD_FLAGS})
+       set(F WS_LD_FLAG_${C})
+       set(${F} ${THIS_FLAG})
+       set(V WS_LD_FLAG_VALID${C})
+       check_c_linker_flag(${${F}} ${V})
+       if (${${V}})
+               set(WS_LINK_FLAGS ${WS_LINK_FLAGS} ${${F}})
+       endif()
+       math(EXPR C "${C} + 1")
+endforeach()
 
+if(ENABLE_STATIC)
+  set(LINK_MODE_LIB STATIC)
+  set(LINK_MODE_MODULE STATIC)
+else()
+  set(LINK_MODE_LIB SHARED)
+  set(LINK_MODE_MODULE MODULE)
+endif()
 
 #The minimum package list
 set(PACKAGELIST GLIB2 PCAP M LEX YACC Perl SH PythonInterp HtmlViewer ${PACKAGELIST})
@@ -186,6 +248,8 @@ set(PACKAGELIST GLIB2 PCAP M LEX YACC Perl SH PythonInterp HtmlViewer ${PACKAGEL
 #Build the gui ?
 if(BUILD_wireshark)
        set(PACKAGELIST GTK2 ${PACKAGELIST})
+       set(GTK2_OPTIONS COMPONENTS gtk)
+       set(GTK2_DEBUG false)
 endif()
 
 # SMI SNMP
@@ -227,8 +291,8 @@ elseif(ENABLE_ADNS)     # Gnu asynchronous DNS
 endif()
 
 # Zlib compression
-if(ENABLE_Z)
-       set(PACKAGELIST Z ${PACKAGELIST})
+if(ENABLE_ZLIB)
+       set(PACKAGELIST ZLIB ${PACKAGELIST})
 endif()
 
 # Lua 5.1 dissectors
@@ -254,7 +318,11 @@ set(PROGLIST text2pcap mergecap capinfos editcap dumpcap)
 
 #Let's loop the package list
 foreach(PACKAGE ${PACKAGELIST})
-       find_package(${PACKAGE} REQUIRED)
+       if(${PACKAGE}_OPTIONS)
+               find_package(${PACKAGE} ${${PACKAGE}_OPTIONS})
+       else()
+               find_package(${PACKAGE} REQUIRED)
+       endif()
        message(${PACKAGE}_FOUND)
        if (${PACKAGE}_FOUND)
                set(HAVE_LIB${PACKAGE} 1)
@@ -266,9 +334,12 @@ endforeach()
 
 find_package(YAPP)
 
+#packaging
+include(CPackConfig.txt)
+
 if(HAVE_LIBPYTHON)
        set(HAVE_PYTHON 1)
-       set(PYTHON_DIR "${CMAKE_INSTALL_PREFIX}/lib/wireshark/python/${VERSION}")
+       set(PYTHON_DIR "${CMAKE_INSTALL_PREFIX}/lib/wireshark/python/${CPACK_PACKAGE_VERSION}")
 endif()
 if(HAVE_LIBLUA)
        set(HAVE_LUA_H 1)
@@ -299,22 +370,6 @@ include(ConfigureChecks.cmake)
 include(TestBigEndian)
 test_big_endian(WORDS_BIGENDIAN)
 
-#packaging
-set(CPACK_PACKAGE_NAME wireshark)
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "capture packet")
-set(CPACK_PACKAGE_VENDOR "wireshark")
-set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
-set(CPACK_PACKAGE_VERSION_MAJOR "1")
-set(CPACK_PACKAGE_VERSION_MINOR "3")
-set(CPACK_PACKAGE_VERSION_PATCH "2")
-set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
-
-set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
-set(CPACK_PACKAGE_INSTALL_DIRECTORY "/usr")
-set(CPACK_GENERATOR "TGZ")
-set(CPACK_SOURCE_GENERATOR "TGZ")
-
 set(DATAFILE_DIR "${CMAKE_INSTALL_PREFIX}/share/${CPACK_PACKAGE_NAME}")
 
 if(ENABLE_PLUGINS)
@@ -326,6 +381,7 @@ if(ENABLE_PLUGINS)
                plugins/ethercat
                plugins/giop
                plugins/gryphon
+               plugins/interlink
                plugins/irda
                plugins/m2m
                plugins/mate
@@ -359,6 +415,13 @@ add_subdirectory( tools/lemon )
 add_subdirectory( wiretap )
 add_subdirectory( wsutil )
 
+if(ENABLE_GUIDES)
+#      FIXME: Disabling the build via option currently doesn't work
+#      add_subdirectory( docbook )
+endif()
+
+find_package(POD)
+
 #Platform specific
 if(UNIX)
        set(WS_VAR_IMPORT "extern")
@@ -396,8 +459,17 @@ link_directories(
        wsutil
 )
 
+ADD_CUSTOM_TARGET(
+       svnversion ALL
+       COMMAND ${PERL}
+               ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
+               ${CMAKE_CURRENT_SOURCE_DIR}
+       DEPENDS
+               ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
+)
+
 ADD_CUSTOM_COMMAND(
-       OUTPUT svnversion.h
+       OUTPUT  svnversion.h
        COMMAND ${PERL}
                ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
                ${CMAKE_CURRENT_SOURCE_DIR}
@@ -410,14 +482,14 @@ register_tap_files(tshark-tap-register.c
 )
 
 ADD_CUSTOM_COMMAND(
-       OUTPUT ps.c
-       COMMAND ${PYTHON_EXECUTABLE}
-         ${CMAKE_CURRENT_SOURCE_DIR}/tools/rdps.py
-         ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
-         ps.c
+       OUTPUT  ps.c
+       COMMAND ${PYTHON_EXECUTABLE}
+               ${CMAKE_CURRENT_SOURCE_DIR}/tools/rdps.py
+               ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
+               ps.c
        DEPENDS
-         ${CMAKE_CURRENT_SOURCE_DIR}/tools/rdps.py
-         ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
+               ${CMAKE_CURRENT_SOURCE_DIR}/tools/rdps.py
+               ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
 )
 
 if(UNIX)
@@ -438,17 +510,22 @@ set(WTAP_PLUGIN_SOURCES
        epan/filesystem.c
 )
 
+set(SHARK_COMMON_CAPTURE_SRC
+       capture_errs.c
+       capture_ifinfo.c
+       capture_ui_utils.c
+)
+
 set(WIRESHARK_COMMON_SRC
        ${PLATFORM_SRC}
-       capture_errs.c
        capture-pcap-util.c
-       capture_ui_utils.c
        cfile.c
        clopts_common.c
        disabled_protos.c
        packet-range.c
        print.c
        ps.c
+       svnversion.h
        sync_pipe_write.c
        timestats.c
        util.c
@@ -465,6 +542,7 @@ set(TSHARK_TAP_SRC
         tap-camelsrt.c
         tap-comparestat.c
         tap-dcerpcstat.c
+        tap-diameter-avp.c
         tap-funnel.c
         tap-gsm_astat.c
         tap-h225counter.c
@@ -500,44 +578,44 @@ set(INSTALL_DIRS
 set(INSTALL_FILES
        ${CMAKE_BINARY_DIR}/AUTHORS-SHORT
        COPYING
-#      capinfos.html
+       ${CMAKE_BINARY_DIR}/capinfos.html
        cfilters
        colorfilters
-#      console.lua
        dfilters
-#      dtd_gen.lua
-#      dumpcap.html
-#      editcap.html
-#      idl2wrs.html
-#      init.lua
-#      ipmap.html
+       ${CMAKE_BINARY_DIR}/dumpcap.html
+       ${CMAKE_BINARY_DIR}/editcap.html
+       ${CMAKE_BINARY_DIR}/idl2wrs.html
+       ipmap.html
        manuf
-#      mergecap.html
-#      rawshark.html
+       ${CMAKE_BINARY_DIR}/mergecap.html
+       ${CMAKE_BINARY_DIR}/rawshark.html
        services
        smi_modules
-#      text2pcap.html
-#      tshark.html
-#      wireshark-filter.html
-#      wireshark.html
-#      ws.css
+       ${CMAKE_BINARY_DIR}/text2pcap.html
+       ${CMAKE_BINARY_DIR}/tshark.html
+       ${CMAKE_BINARY_DIR}/wireshark-filter.html
+       ${CMAKE_BINARY_DIR}/wireshark.html
+       docbook/ws.css
 )
 
 set(LIBEPAN_LIBS
-#              $(wireshark_optional_objects)
+#              @GETOPT_O@      # wsgetopt.c
+#              @INET_ATON_LO@  # epan/inet_aton.c
+#              @INET_NTOP_LO@  # inet_ntop.c
+#              @INET_PTON_LO@  # inet_pton.c
+#              @NSL_LIBS@      # -lnsl
+#              @SOCKET_LIBS@   # -lsocket
+#              @SSL_LIBS@      # -lcrypto
+#              @STRERROR_O@    # strerror.c
+#              @STRNCASECMP_O@ # strncasecmp.c
+#              @STRPTIME_O@    # strptime.c
                epan
-#              @INET_PTON_LO@
-#              @INET_NTOP_LO@
-#              @SSL_LIBS@
-#              $(plugin_ldadd)
+#              $(plugin_ldadd) # in case of static
                ${PCRE_LIBRARIES}
                ${PCAP_LIBRARIES}
-#              @SOCKET_LIBS@
-#              @NSL_LIBS@
                ${CARES_LIBRARIES}
                ${ADNS_LIBRARIES}
                ${KERBEROS_LIBRARIES}
-#              @FRAMEWORKS@
                ${LUA_LIBRARIES}
                ${PYTHON_LIBRARIES}
                ${GEOIP_LIBRARIES}
@@ -574,9 +652,12 @@ if(BUILD_wireshark)
                proto_hier_stats.c
                summary.c
                tempfile.c
+               ${SHARK_COMMON_CAPTURE_SRC}
                ${WIRESHARK_COMMON_SRC}
        )
        add_executable(wireshark ${wireshark_FILES})
+       add_dependencies(wireshark svnversion)
+       set_target_properties(wireshark PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
        target_link_libraries(wireshark ${wireshark_LIBS})
        install(TARGETS wireshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 endif()
@@ -593,9 +674,12 @@ if(BUILD_tshark)
                tshark-tap-register.c
                tshark.c
                ${TSHARK_TAP_SRC}
+               ${SHARK_COMMON_CAPTURE_SRC}
                ${WIRESHARK_COMMON_SRC}
        )
        add_executable(tshark ${tshark_FILES})
+       add_dependencies(tshark svnversion)
+       set_target_properties(tshark PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
        target_link_libraries(tshark ${tshark_LIBS})
        install(TARGETS tshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 endif()
@@ -610,6 +694,8 @@ if(BUILD_rawshark)
                rawshark.c
        )
        add_executable(rawshark ${rawshark_FILES})
+       add_dependencies(rawshark svnversion)
+       set_target_properties(rawshark PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
        target_link_libraries(rawshark ${rawshark_LIBS})
        install(TARGETS rawshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 endif()
@@ -623,6 +709,7 @@ if(BUILD_dftest)
                util.c
        )
        add_executable(dftest ${dftest_FILES})
+       set_target_properties(dftest PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
        target_link_libraries(dftest ${dftest_LIBS})
        install(TARGETS dftest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 endif()
@@ -642,6 +729,7 @@ if(BUILD_randpkt)
                randpkt.c
        )
        add_executable(randpkt ${randpkt_FILES})
+       set_target_properties(randpkt PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
        target_link_libraries(randpkt ${randpkt_LIBS})
        install(TARGETS randpkt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 endif()
@@ -655,13 +743,12 @@ if(BUILD_text2pcap)
        set(text2pcap_FILES
                text2pcap.c
        )
-       set(text2pcap_CLEAN_FILES
-               ${text2pcap_FILES}
-       )
        add_lex_files(text2pcap_FILES
                text2pcap-scanner.l
        )
        add_executable(text2pcap ${text2pcap_FILES})
+       add_dependencies(text2pcap svnversion)
+       set_target_properties(text2pcap PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
        target_link_libraries(text2pcap ${text2pcap_LIBS})
        install(TARGETS text2pcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 endif()
@@ -677,6 +764,8 @@ if(BUILD_mergecap)
                svnversion.h
        )
        add_executable(mergecap ${mergecap_FILES})
+       add_dependencies(mergecap svnversion)
+       set_target_properties(mergecap PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
        target_link_libraries(mergecap ${mergecap_LIBS})
        install(TARGETS mergecap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 endif()
@@ -685,6 +774,7 @@ if(BUILD_capinfos)
        set(capinfos_LIBS
                wiretap
                ${Z_LIBRARIES}
+               ${GCRYPT_LIBRARIES}
                ${APPLE_COCOA_LIBRARY}
        )
        set(capinfos_FILES
@@ -692,6 +782,7 @@ if(BUILD_capinfos)
                ${WTAP_PLUGIN_SOURCES}
        )
        add_executable(capinfos ${capinfos_FILES})
+       set_target_properties(capinfos PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
        target_link_libraries(capinfos ${capinfos_LIBS})
        install(TARGETS capinfos RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 endif()
@@ -708,6 +799,8 @@ if(BUILD_editcap)
                ${WTAP_PLUGIN_SOURCES}
        )
        add_executable(editcap ${editcap_FILES})
+       add_dependencies(editcap svnversion)
+       set_target_properties(editcap PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
        target_link_libraries(editcap ${editcap_LIBS})
        install(TARGETS editcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 endif()
@@ -720,7 +813,6 @@ if(BUILD_dumpcap)
                ${CAP_LIBRARIES}
 #              @SOCKET_LIBS@
 #              @NSL_LIBS@
-#              @FRAMEWORKS@
                ${GCRYPT_LIBRARIES}
                ${GNUTLS_LIBRARIES}
                ${Z_LIBRARIES}
@@ -742,6 +834,8 @@ if(BUILD_dumpcap)
                ${PLATFORM_SRC}
        )
        add_executable(dumpcap ${dumpcap_FILES})
+       add_dependencies(dumpcap svnversion)
+       set_target_properties(dumpcap PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
        target_link_libraries(dumpcap ${dumpcap_LIBS})
        install(TARGETS dumpcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 endif()
@@ -759,11 +853,80 @@ ADD_CUSTOM_COMMAND(
                ${CMAKE_SOURCE_DIR}/AUTHORS
 )
 
+ADD_CUSTOM_COMMAND(
+       OUTPUT  AUTHORS-SHORT-FORMAT
+               wireshark.pod
+       COMMAND ${PERL}
+               ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
+               ${CMAKE_SOURCE_DIR}/doc/make-authors-format.pl
+               < AUTHORS-SHORT
+               > AUTHORS-SHORT-FORMAT
+       COMMAND cat
+               ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
+               AUTHORS-SHORT-FORMAT
+               > wireshark.pod
+       DEPENDS
+               ${CMAKE_SOURCE_DIR}/doc/perlnoutf.pl
+               ${CMAKE_SOURCE_DIR}/doc/make-authors-format.pl
+               AUTHORS-SHORT
+               ${CMAKE_SOURCE_DIR}/doc/wireshark.pod.template
+)
+
+ADD_CUSTOM_COMMAND(
+       OUTPUT  wireshark-filter.pod
+       COMMAND tshark
+               -G fields |
+               ${PERL}
+               ${CMAKE_SOURCE_DIR}/doc/dfilter2pod.pl
+               ${CMAKE_SOURCE_DIR}/doc/wireshark-filter.pod.template
+               > wireshark-filter.pod
+       DEPENDS
+               ${CMAKE_SOURCE_DIR}/doc/dfilter2pod.pl
+               ${CMAKE_SOURCE_DIR}/doc/wireshark-filter.pod.template
+               tshark
+)
+
+pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/capinfos 1 )
+pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dumpcap 1 )
+pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/editcap 1 )
+pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2wrs 1 )
+pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/mergecap 1 )
+pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/rawshark 1 )
+pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/text2pcap 1 )
+pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/tshark 1 )
+pod2manhtml( wireshark 1 )
+pod2manhtml( wireshark-filter 4 )
+
 add_custom_target(
        auxiliary ALL
        DEPENDS
                AUTHORS-SHORT
-               # todo: Add manpages and onlinedocs and generate them
+               capinfos.html
+               dumpcap.html
+               editcap.html
+               idl2wrs.html
+               mergecap.html
+               rawshark.html
+               text2pcap.html
+               tshark.html
+               wireshark.html
+               wireshark-filter.html
+)
+
+set(MAN1_FILES
+       ${CMAKE_BINARY_DIR}/capinfos.1
+       ${CMAKE_BINARY_DIR}/dumpcap.1
+       ${CMAKE_BINARY_DIR}/editcap.1
+       ${CMAKE_BINARY_DIR}/idl2wrs.1
+       ${CMAKE_BINARY_DIR}/mergecap.1
+       ${CMAKE_BINARY_DIR}/rawshark.1
+       ${CMAKE_BINARY_DIR}/text2pcap.1
+       ${CMAKE_BINARY_DIR}/tshark.1
+       ${CMAKE_BINARY_DIR}/wireshark.1
+)
+
+set(MAN4_FILES
+       ${CMAKE_BINARY_DIR}/wireshark-filter.4
 )
 
 set(CLEAN_FILES
@@ -772,7 +935,7 @@ set(CLEAN_FILES
        ${rawshark_FILES}
        ${dftest_FILES}
        ${randpkt_FILES}
-       ${text2pcap_CLEAN_FILES}
+       ${text2pcap_FILES}
        ${mergecap_FILES}
        ${capinfos_FILES}
        ${editcap_FILES}
@@ -794,6 +957,20 @@ install(
                ${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
 )
 
+install(
+       FILES
+               ${MAN1_FILES}
+       DESTINATION
+               ${CMAKE_INSTALL_MANDIR}/man1
+)
+
+install(
+       FILES
+               ${MAN4_FILES}
+       DESTINATION
+               ${CMAKE_INSTALL_MANDIR}/man4
+)
+
 install(
        DIRECTORY
                ${INSTALL_DIRS}