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}/tools/lemon
51 ${CMAKE_SOURCE_DIR}/wiretap
52 ${CMAKE_SOURCE_DIR}/wsutil
55 #Where to put libraries
56 if(NOT LIBRARY_OUTPUT_PATH)
57 set(LIBRARY_OUTPUT_PATH ${wireshark_BINARY_DIR}/lib CACHE INTERNAL
58 "Single output directory for building all libraries.")
61 option(BUILD_wireshark "Build the GUI version of Wireshark" ON)
62 option(BUILD_tshark "Build tshark" ON)
63 option(BUILD_rawshark "Build rawshark" ON)
64 option(BUILD_dumpcap "Build dumpcap" ON)
65 option(BUILD_text2pcap "Build text2pcap" ON)
66 option(BUILD_mergecap "Build mergecap" ON)
67 option(BUILD_editcap "Build editcap" ON)
68 option(BUILD_capinfos "Build capinfos" ON)
69 option(BUILD_randpkt "Build randpkt" ON)
70 option(BUILD_dftest "Build dftest" ON)
71 option(ENABLE_STATIC "Build a static version of Wireshark" OFF)
72 option(ENABLE_ADNS "Build with adns support" ON)
73 option(ENABLE_EXTRA_GCC_CHECKS "Do additional -W checks in GCC" OFF)
75 if(ENABLE_EXTRA_GCC_CHECKS)
76 set(WIRESHARK_EXTRA_GCC_FLAGS -Wcast-qual -Wcast-align -Wbad-function-cast
77 -pedantic -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings)
82 -DPACKAGE=\"wireshark\"
86 if(CMAKE_COMPILER_IS_GNUCC)
88 -D_U_=__attribute__\(\(unused\)\)
89 -Wall -Wpointer-arith -W
90 ${WIRESHARK_EXTRA_GCC_FLAGS}
93 add_definitions(-D_U_=\"\")
96 #The minimum package list
97 set(PACKAGELIST GLIB2 PCAP MATH LEX YACC Perl SH PythonInterp HtmlViewer ${PACKAGELIST})
101 set(PACKAGELIST GTK2 ${PACKAGELIST})
104 # Regular expressions lib
106 set(PACKAGELIST PCRE ${PACKAGELIST})
109 #Gnu asynchronous DNS
111 set(PACKAGELIST ADNS ${PACKAGELIST})
114 set(PROGLIST text2pcap mergecap capinfos editcap dumpcap)
116 #Let's loop the package list
117 foreach(PACKAGE ${PACKAGELIST})
118 find_package(${PACKAGE} REQUIRED)
119 message(${PACKAGE}_FOUND)
120 if (${PACKAGE}_FOUND)
121 set(HAVE_LIB${PACKAGE} "1")
122 include_directories(${${PACKAGE}_INCLUDE_DIRS})
123 message(STATUS "${PACKAGE} include ${${PACKAGE}_INCLUDE_DIRS}")
124 message(STATUS "${PACKAGE} lib ${${PACKAGE}_LIBRARIES}")
128 # Hack for now: compat with current configure stuff
134 set(CPACK_PACKAGE_NAME wireshark)
135 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "capture packet")
136 set(CPACK_PACKAGE_VENDOR "wireshark")
137 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
138 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
139 set(CPACK_PACKAGE_VERSION_MAJOR "1")
140 set(CPACK_PACKAGE_VERSION_MINOR "3")
141 set(CPACK_PACKAGE_VERSION_PATCH "0")
142 set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
144 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
145 set(CPACK_PACKAGE_INSTALL_DIRECTORY "/usr")
146 set(CPACK_GENERATOR "TGZ")
147 set(CPACK_SOURCE_GENERATOR "TGZ")
149 include(ConfigureChecks.cmake)
151 #Big or little endian ?
152 include(TestBigEndian)
153 test_big_endian(WORDS_BIGENDIAN)
155 set(DATAFILE_DIR "${CMAKE_INSTALL_PREFIX}/share/${CPACK_PACKAGE_NAME}")
159 set(WS_VAR_IMPORT "extern")
163 #TODO verify that APPLE implies HAVE_OS_X_FRAMEWORKS
164 set(HAVE_OS_X_FRAMEWORKS 1)
168 add_definitions(-DHAVE_WIN32_LIBWIRESHARK_LIB -D_NEED_VAR_IMPORT_)
169 set(WS_VAR_IMPORT "__declspec(dllimport) extern")
171 # Disable deprecation
173 add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
178 add_subdirectory( epan )
179 add_subdirectory( gtk )
180 add_subdirectory( wiretap )
181 add_subdirectory( wsutil )
183 configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h)
192 link_directories( gtk )
196 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h
197 COMMAND ${PERL} ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
198 ${CMAKE_CURRENT_SOURCE_DIR}
200 SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/svnversion.h GENERATED)
202 # Create the necessary tools
207 # Do we need something here on any platform?
209 add_executable(lemon ${lemon_FILES})
210 target_link_libraries(lemon ${lemon_LIBS})
214 OUTPUT tshark-tap-register.c
216 ${CMAKE_SOURCE_DIR}/make-tapreg-dotc
217 tshark-tap-register.c
218 ${CMAKE_CURRENT_SOURCE_DIR}
221 ${CMAKE_SOURCE_DIR}/make-tapreg-dotc
227 COMMAND ${PYTHON_EXECUTABLE}
228 ${CMAKE_CURRENT_SOURCE_DIR}/rdps.py
229 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
232 ${CMAKE_CURRENT_SOURCE_DIR}/rdps.py
233 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
238 capture-pcap-util-unix.c
244 capture-wpcap.c capture_wpcap_packet.c
248 set(WIRESHARK_COMMON_SRC
299 # $(wireshark_optional_objects)
328 ${PORTAUDIO_LIBRARIES}
347 ${WIRESHARK_COMMON_SRC}
349 add_executable(wireshark ${wireshark_FILES})
350 target_link_libraries(wireshark ${wireshark_LIBS})
351 install(TARGETS wireshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
362 tshark-tap-register.c
365 ${WIRESHARK_COMMON_SRC}
367 add_executable(tshark ${tshark_FILES})
368 target_link_libraries(tshark ${tshark_LIBS})
369 install(TARGETS tshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
377 ${WIRESHARK_COMMON_SRC}
380 add_executable(rawshark ${rawshark_FILES})
381 target_link_libraries(rawshark ${rawshark_LIBS})
382 install(TARGETS rawshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
393 add_executable(dftest ${dftest_FILES})
394 target_link_libraries(dftest ${dftest_LIBS})
395 install(TARGETS dftest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
413 add_executable(randpkt ${randpkt_FILES})
414 target_link_libraries(randpkt ${randpkt_LIBS})
415 install(TARGETS randpkt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
428 add_lex_files(text2pcap_FILES
431 add_executable(text2pcap ${text2pcap_FILES})
432 target_link_libraries(text2pcap ${text2pcap_LIBS})
433 install(TARGETS text2pcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
447 add_executable(mergecap ${mergecap_FILES})
448 target_link_libraries(mergecap ${mergecap_LIBS})
449 install(TARGETS mergecap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
461 add_executable(capinfos ${capinfos_FILES})
462 target_link_libraries(capinfos ${capinfos_LIBS})
463 install(TARGETS capinfos RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
474 epan/crypt/crypt-md5.c
477 add_executable(editcap ${editcap_FILES})
478 target_link_libraries(editcap ${editcap_LIBS})
479 install(TARGETS editcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
501 capture_stop_conditions.c
512 add_executable(dumpcap ${dumpcap_FILES})
513 target_link_libraries(dumpcap ${dumpcap_LIBS})
514 install(TARGETS dumpcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})