5 # Wireshark - Network traffic analyzer
6 # By Gerald Combs <gerald@wireshark.org>
7 # Copyright 1998 Gerald Combs
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 cmake_minimum_required(VERSION 2.6)
28 #Where to find local cmake scripts
29 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
32 # Under linux the release mode (CMAKE_BUILD_TYPE=release) defines NDEBUG
34 # Disable this later. Alternative: "make VERBOSE=1"
35 set(CMAKE_VERBOSE_MAKEFILE ON)
37 set(BUILD_SHARED_LIBS ON)
39 #Defines CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_DATADIR, etc ...
40 include(CMakeInstallDirs)
44 ${CMAKE_BINARY_DIR}/epan
45 ${CMAKE_BINARY_DIR}/epan/wslua
46 ${CMAKE_BINARY_DIR}/epan/wspython
48 ${CMAKE_SOURCE_DIR}/epan
49 ${CMAKE_SOURCE_DIR}/epan/dfilter
50 ${CMAKE_SOURCE_DIR}/epan/dissectors
51 ${CMAKE_SOURCE_DIR}/epan/ftypes
52 ${CMAKE_SOURCE_DIR}/epan/wslua
53 ${CMAKE_SOURCE_DIR}/epan/wspython
54 ${CMAKE_SOURCE_DIR}/tools/lemon
55 ${CMAKE_SOURCE_DIR}/wiretap
56 ${CMAKE_SOURCE_DIR}/wsutil
59 #Where to put libraries
60 if(NOT LIBRARY_OUTPUT_PATH)
61 set(LIBRARY_OUTPUT_PATH ${wireshark_BINARY_DIR}/lib CACHE INTERNAL
62 "Single output directory for building all libraries.")
65 option(BUILD_wireshark "Build the GUI version of Wireshark" ON)
66 option(BUILD_tshark "Build tshark" ON)
67 option(BUILD_rawshark "Build rawshark" ON)
68 option(BUILD_dumpcap "Build dumpcap" ON)
69 option(BUILD_text2pcap "Build text2pcap" ON)
70 option(BUILD_mergecap "Build mergecap" ON)
71 option(BUILD_editcap "Build editcap" ON)
72 option(BUILD_capinfos "Build capinfos" ON)
73 option(BUILD_randpkt "Build randpkt" ON)
74 option(BUILD_dftest "Build dftest" ON)
76 option(ENABLE_EXTRA_GCC_CHECKS "Do additional -W checks in GCC" OFF)
77 option(ENABLE_AIRPCAP "Enable Airpcap support" ON)
79 option(ENABLE_STATIC "Build a static version of Wireshark" OFF)
81 option(ENABLE_ADNS "Build with adns support" ON)
82 option(ENABLE_PCRE "Build with pcre support" ON)
83 option(ENABLE_PORTAUDIO "Build with portaudio support" ON)
84 option(ENABLE_Z "Build with zlib compression support" ON)
85 # todo wslua currently seems to be broken
86 option(ENABLE_LUA "Build with lua dissector support" OFF)
87 option(ENABLE_PYTHON "Build with python dissector support" ON)
88 option(ENABLE_SMI "Build with smi snmp support" ON)
89 option(ENABLE_GNUTLS "Build with GNU TLS support" ON)
90 option(ENABLE_GCRYPT "Build with GNU crypto support" ON)
91 option(ENABLE_GEOIP "Build with GeoIP support" ON)
92 option(ENABLE_CAP "Build with posix capabilities support" ON)
93 option(ENABLE_CARES "Build with c_ares support" ON)
94 # todo Mostly hardcoded
95 option(ENABLE_KERBEROS "Build with Kerberos support" ON)
98 if(ENABLE_EXTRA_GCC_CHECKS)
99 set(WIRESHARK_EXTRA_GCC_FLAGS -Wcast-qual -Wcast-align -Wbad-function-cast
100 -pedantic -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings)
105 -DPACKAGE=\"wireshark\"
109 if(CMAKE_COMPILER_IS_GNUCC)
111 -D_U_=__attribute__\(\(unused\)\)
112 -Wall -Wpointer-arith -W
113 ${WIRESHARK_EXTRA_GCC_FLAGS}
116 add_definitions(-D_U_=\"\")
119 #The minimum package list
120 set(PACKAGELIST GLIB2 PCAP M LEX YACC Perl SH PythonInterp HtmlViewer ${PACKAGELIST})
124 set(PACKAGELIST GTK2 ${PACKAGELIST})
129 set(PACKAGELIST SMI ${PACKAGELIST})
134 set(PACKAGELIST GCRYPT ${PACKAGELIST})
137 # GNU SSL/TLS support
139 set(PACKAGELIST GNUTLS ${PACKAGELIST})
142 # Regular expressions lib
144 set(PACKAGELIST PCRE ${PACKAGELIST})
149 set(PACKAGELIST KERBEROS ${PACKAGELIST})
154 set(PACKAGELIST PORTAUDIO ${PACKAGELIST})
158 # Prefer c-ares over adns
159 if(ENABLE_CARES) # C Asynchronouse resolver
160 set(PACKAGELIST CARES ${PACKAGELIST})
161 elseif(ENABLE_ADNS) # Gnu asynchronous DNS
162 set(PACKAGELIST ADNS ${PACKAGELIST})
167 set(PACKAGELIST Z ${PACKAGELIST})
172 set(PACKAGELIST LUA ${PACKAGELIST})
175 # GeoIP address resolving
177 set(PACKAGELIST GEOIP ${PACKAGELIST})
182 set(PACKAGELIST CAP ${PACKAGELIST})
186 set(PACKAGELIST PYTHON ${PACKAGELIST})
189 set(PROGLIST text2pcap mergecap capinfos editcap dumpcap)
191 #Let's loop the package list
192 foreach(PACKAGE ${PACKAGELIST})
193 find_package(${PACKAGE} REQUIRED)
194 message(${PACKAGE}_FOUND)
195 if (${PACKAGE}_FOUND)
196 set(HAVE_LIB${PACKAGE} 1)
197 include_directories(${${PACKAGE}_INCLUDE_DIRS})
198 message(STATUS "${PACKAGE} includes: ${${PACKAGE}_INCLUDE_DIRS}")
199 message(STATUS "${PACKAGE} libs: ${${PACKAGE}_LIBRARIES}")
205 set(PYTHON_DIR "${CMAKE_INSTALL_PREFIX}/lib/wireshark/python/${VERSION}")
213 # HAVE_HEIMDAL_KERBEROS
214 set(HAVE_MIT_KERBEROS 1)
215 set(HAVE_KEYTYPE_ARCFOUR_56 1)
231 set(CPACK_PACKAGE_NAME wireshark)
232 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "capture packet")
233 set(CPACK_PACKAGE_VENDOR "wireshark")
234 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
235 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
236 set(CPACK_PACKAGE_VERSION_MAJOR "1")
237 set(CPACK_PACKAGE_VERSION_MINOR "3")
238 set(CPACK_PACKAGE_VERSION_PATCH "0")
239 set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
241 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
242 set(CPACK_PACKAGE_INSTALL_DIRECTORY "/usr")
243 set(CPACK_GENERATOR "TGZ")
244 set(CPACK_SOURCE_GENERATOR "TGZ")
246 include(ConfigureChecks.cmake)
248 #Big or little endian ?
249 include(TestBigEndian)
250 test_big_endian(WORDS_BIGENDIAN)
252 set(DATAFILE_DIR "${CMAKE_INSTALL_PREFIX}/share/${CPACK_PACKAGE_NAME}")
256 set(WS_VAR_IMPORT "extern")
260 #TODO verify that APPLE implies HAVE_OS_X_FRAMEWORKS
261 set(HAVE_OS_X_FRAMEWORKS 1)
265 add_definitions(-D_NEED_VAR_IMPORT_)
266 set(WS_VAR_IMPORT "__declspec(dllimport) extern")
268 # Disable deprecation
270 add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
275 add_subdirectory( epan )
276 add_subdirectory( gtk )
277 add_subdirectory( codecs )
278 add_subdirectory( wiretap )
279 add_subdirectory( wsutil )
281 configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h)
292 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h
293 COMMAND ${PERL} ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
294 ${CMAKE_CURRENT_SOURCE_DIR}
296 SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/svnversion.h GENERATED)
298 # Create the necessary tools
303 # Do we need something here on any platform?
305 add_executable(lemon ${lemon_FILES})
306 target_link_libraries(lemon ${lemon_LIBS})
310 OUTPUT tshark-tap-register.c
312 ${CMAKE_SOURCE_DIR}/make-tapreg-dotc
313 tshark-tap-register.c
314 ${CMAKE_CURRENT_SOURCE_DIR}
317 ${CMAKE_SOURCE_DIR}/make-tapreg-dotc
323 COMMAND ${PYTHON_EXECUTABLE}
324 ${CMAKE_CURRENT_SOURCE_DIR}/rdps.py
325 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
328 ${CMAKE_CURRENT_SOURCE_DIR}/rdps.py
329 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
334 capture-pcap-util-unix.c
340 capture-wpcap.c capture_wpcap_packet.c
344 set(WIRESHARK_COMMON_SRC
395 # $(wireshark_optional_objects)
410 ${KERBEROS_LIBRARIES}
427 ${PORTAUDIO_LIBRARIES}
446 ${WIRESHARK_COMMON_SRC}
448 add_executable(wireshark ${wireshark_FILES})
449 target_link_libraries(wireshark ${wireshark_LIBS})
450 install(TARGETS wireshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
461 tshark-tap-register.c
464 ${WIRESHARK_COMMON_SRC}
466 add_executable(tshark ${tshark_FILES})
467 target_link_libraries(tshark ${tshark_LIBS})
468 install(TARGETS tshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
476 ${WIRESHARK_COMMON_SRC}
479 add_executable(rawshark ${rawshark_FILES})
480 target_link_libraries(rawshark ${rawshark_LIBS})
481 install(TARGETS rawshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
492 add_executable(dftest ${dftest_FILES})
493 target_link_libraries(dftest ${dftest_LIBS})
494 install(TARGETS dftest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
513 add_executable(randpkt ${randpkt_FILES})
514 target_link_libraries(randpkt ${randpkt_LIBS})
515 install(TARGETS randpkt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
529 add_lex_files(text2pcap_FILES
532 add_executable(text2pcap ${text2pcap_FILES})
533 target_link_libraries(text2pcap ${text2pcap_LIBS})
534 install(TARGETS text2pcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
549 add_executable(mergecap ${mergecap_FILES})
550 target_link_libraries(mergecap ${mergecap_LIBS})
551 install(TARGETS mergecap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
564 add_executable(capinfos ${capinfos_FILES})
565 target_link_libraries(capinfos ${capinfos_LIBS})
566 install(TARGETS capinfos RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
578 epan/crypt/crypt-md5.c
581 add_executable(editcap ${editcap_FILES})
582 target_link_libraries(editcap ${editcap_LIBS})
583 install(TARGETS editcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
606 capture_stop_conditions.c
617 add_executable(dumpcap ${dumpcap_FILES})
618 target_link_libraries(dumpcap ${dumpcap_LIBS})
619 install(TARGETS dumpcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})