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
46 ${CMAKE_SOURCE_DIR}/epan
47 ${CMAKE_SOURCE_DIR}/epan/dfilter
48 ${CMAKE_SOURCE_DIR}/epan/dissectors
49 ${CMAKE_SOURCE_DIR}/epan/ftypes
50 ${CMAKE_SOURCE_DIR}/epan/wslua
51 ${CMAKE_SOURCE_DIR}/epan/wspython
52 ${CMAKE_SOURCE_DIR}/tools/lemon
53 ${CMAKE_SOURCE_DIR}/wiretap
54 ${CMAKE_SOURCE_DIR}/wsutil
57 #Where to put libraries
58 if(NOT LIBRARY_OUTPUT_PATH)
59 set(LIBRARY_OUTPUT_PATH ${wireshark_BINARY_DIR}/lib CACHE INTERNAL
60 "Single output directory for building all libraries.")
63 option(BUILD_wireshark "Build the GUI version of Wireshark" ON)
64 option(BUILD_tshark "Build tshark" ON)
65 option(BUILD_rawshark "Build rawshark" ON)
66 option(BUILD_dumpcap "Build dumpcap" ON)
67 option(BUILD_text2pcap "Build text2pcap" ON)
68 option(BUILD_mergecap "Build mergecap" ON)
69 option(BUILD_editcap "Build editcap" ON)
70 option(BUILD_capinfos "Build capinfos" ON)
71 option(BUILD_randpkt "Build randpkt" ON)
72 option(BUILD_dftest "Build dftest" ON)
75 option(ENABLE_EXTRA_GCC_CHECKS "Do additional -W checks in GCC" OFF)
76 option(ENABLE_AIRPCAP "Enable Airpcap support" ON)
78 option(ENABLE_STATIC "Build a static version of Wireshark" OFF)
80 option(ENABLE_CARES "Build with c_ares support" 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 option(ENABLE_LUA "Build with lua dissector support" ON)
86 option(ENABLE_SMI "Build with smi snmp support" ON)
88 option(ENABLE_GNUTLS "Build with GNU TLS support" ON)
89 option(ENABLE_GCRYPT "Build with GNU crypto support" ON)
90 option(ENABLE_KRB5 "Build with MIT Kerberos 5 support" ON)
91 option(ENABLE_GEOIP "Build with GeoIP support" ON)
92 option(ENABLE_PYTHON "Build with python dissector support" ON)
93 option(ENABLE_CAP "Build with posix capabilities support" OFF)
96 if(ENABLE_EXTRA_GCC_CHECKS)
97 set(WIRESHARK_EXTRA_GCC_FLAGS -Wcast-qual -Wcast-align -Wbad-function-cast
98 -pedantic -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings)
103 -DPACKAGE=\"wireshark\"
107 if(CMAKE_COMPILER_IS_GNUCC)
109 -D_U_=__attribute__\(\(unused\)\)
110 -Wall -Wpointer-arith -W
111 ${WIRESHARK_EXTRA_GCC_FLAGS}
114 add_definitions(-D_U_=\"\")
117 #The minimum package list
118 set(PACKAGELIST GLIB2 PCAP MATH LEX YACC Perl SH PythonInterp HtmlViewer ${PACKAGELIST})
122 set(PACKAGELIST GTK2 ${PACKAGELIST})
127 set(PACKAGELIST SMI ${PACKAGELIST})
132 set(PACKAGELIST GCRYPT ${PACKAGELIST})
135 # GNU SSL/TLS support
137 set(PACKAGELIST GNUTLS ${PACKAGELIST})
140 # Regular expressions lib
142 set(PACKAGELIST PCRE ${PACKAGELIST})
147 set(PACKAGELIST PORTAUDIO ${PACKAGELIST})
150 # C Asynchronouse resolver
152 set(PACKAGELIST CARES ${PACKAGELIST})
155 #Gnu asynchronous DNS
157 set(PACKAGELIST ADNS ${PACKAGELIST})
162 set(PACKAGELIST Z ${PACKAGELIST})
167 set(PACKAGELIST LUA ${PACKAGELIST})
170 set(PROGLIST text2pcap mergecap capinfos editcap dumpcap)
172 #Let's loop the package list
173 foreach(PACKAGE ${PACKAGELIST})
174 find_package(${PACKAGE} REQUIRED)
175 message(${PACKAGE}_FOUND)
176 if (${PACKAGE}_FOUND)
177 set(HAVE_LIB${PACKAGE} "1")
178 include_directories(${${PACKAGE}_INCLUDE_DIRS})
179 message(STATUS "${PACKAGE} includes: ${${PACKAGE}_INCLUDE_DIRS}")
180 message(STATUS "${PACKAGE} libs: ${${PACKAGE}_LIBRARIES}")
199 set(CPACK_PACKAGE_NAME wireshark)
200 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "capture packet")
201 set(CPACK_PACKAGE_VENDOR "wireshark")
202 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
203 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
204 set(CPACK_PACKAGE_VERSION_MAJOR "1")
205 set(CPACK_PACKAGE_VERSION_MINOR "3")
206 set(CPACK_PACKAGE_VERSION_PATCH "0")
207 set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
209 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
210 set(CPACK_PACKAGE_INSTALL_DIRECTORY "/usr")
211 set(CPACK_GENERATOR "TGZ")
212 set(CPACK_SOURCE_GENERATOR "TGZ")
214 include(ConfigureChecks.cmake)
216 #Big or little endian ?
217 include(TestBigEndian)
218 test_big_endian(WORDS_BIGENDIAN)
220 set(DATAFILE_DIR "${CMAKE_INSTALL_PREFIX}/share/${CPACK_PACKAGE_NAME}")
224 set(WS_VAR_IMPORT "extern")
228 #TODO verify that APPLE implies HAVE_OS_X_FRAMEWORKS
229 set(HAVE_OS_X_FRAMEWORKS 1)
233 add_definitions(-DHAVE_WIN32_LIBWIRESHARK_LIB -D_NEED_VAR_IMPORT_)
234 set(WS_VAR_IMPORT "__declspec(dllimport) extern")
236 # Disable deprecation
238 add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
243 add_subdirectory( epan )
244 add_subdirectory( gtk )
245 add_subdirectory( codecs )
246 add_subdirectory( wiretap )
247 add_subdirectory( wsutil )
249 configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h)
260 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h
261 COMMAND ${PERL} ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
262 ${CMAKE_CURRENT_SOURCE_DIR}
264 SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/svnversion.h GENERATED)
266 # Create the necessary tools
271 # Do we need something here on any platform?
273 add_executable(lemon ${lemon_FILES})
274 target_link_libraries(lemon ${lemon_LIBS})
278 OUTPUT tshark-tap-register.c
280 ${CMAKE_SOURCE_DIR}/make-tapreg-dotc
281 tshark-tap-register.c
282 ${CMAKE_CURRENT_SOURCE_DIR}
285 ${CMAKE_SOURCE_DIR}/make-tapreg-dotc
291 COMMAND ${PYTHON_EXECUTABLE}
292 ${CMAKE_CURRENT_SOURCE_DIR}/rdps.py
293 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
296 ${CMAKE_CURRENT_SOURCE_DIR}/rdps.py
297 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
302 capture-pcap-util-unix.c
308 capture-wpcap.c capture_wpcap_packet.c
312 set(WIRESHARK_COMMON_SRC
363 # $(wireshark_optional_objects)
393 ${PORTAUDIO_LIBRARIES}
412 ${WIRESHARK_COMMON_SRC}
414 add_executable(wireshark ${wireshark_FILES})
415 target_link_libraries(wireshark ${wireshark_LIBS})
416 install(TARGETS wireshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
427 tshark-tap-register.c
430 ${WIRESHARK_COMMON_SRC}
432 add_executable(tshark ${tshark_FILES})
433 target_link_libraries(tshark ${tshark_LIBS})
434 install(TARGETS tshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
442 ${WIRESHARK_COMMON_SRC}
445 add_executable(rawshark ${rawshark_FILES})
446 target_link_libraries(rawshark ${rawshark_LIBS})
447 install(TARGETS rawshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
458 add_executable(dftest ${dftest_FILES})
459 target_link_libraries(dftest ${dftest_LIBS})
460 install(TARGETS dftest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
479 add_executable(randpkt ${randpkt_FILES})
480 target_link_libraries(randpkt ${randpkt_LIBS})
481 install(TARGETS randpkt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
495 add_lex_files(text2pcap_FILES
498 add_executable(text2pcap ${text2pcap_FILES})
499 target_link_libraries(text2pcap ${text2pcap_LIBS})
500 install(TARGETS text2pcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
515 add_executable(mergecap ${mergecap_FILES})
516 target_link_libraries(mergecap ${mergecap_LIBS})
517 install(TARGETS mergecap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
530 add_executable(capinfos ${capinfos_FILES})
531 target_link_libraries(capinfos ${capinfos_LIBS})
532 install(TARGETS capinfos RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
544 epan/crypt/crypt-md5.c
547 add_executable(editcap ${editcap_FILES})
548 target_link_libraries(editcap ${editcap_LIBS})
549 install(TARGETS editcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
572 capture_stop_conditions.c
583 add_executable(dumpcap ${dumpcap_FILES})
584 target_link_libraries(dumpcap ${dumpcap_LIBS})
585 install(TARGETS dumpcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})