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)
80 if(CMAKE_COMPILER_IS_GNUCC)
83 -D_U_=__attribute__\(\(unused\)\)
84 -DPACKAGE=\"wireshark\"
85 -Wall -Wpointer-arith -W
86 ${WIRESHARK_EXTRA_GCC_FLAGS}
89 add_definitions(-DPACKAGE=\"wireshark\" -DHAVE_CONFIG_H -D_U_=\"\")
92 #The minimum package list
93 set(PACKAGELIST GLIB2 PCAP MATH LEX YACC Perl SH PythonInterp HtmlViewer ${PACKAGELIST})
97 set(PACKAGELIST GTK2 ${PACKAGELIST})
100 # Regular expressions lib
102 set(PACKAGELIST PCRE ${PACKAGELIST})
105 #Gnu asynchronous DNS
107 set(PACKAGELIST ADNS ${PACKAGELIST})
110 set(PROGLIST text2pcap mergecap capinfos editcap dumpcap)
112 #Let's loop the package list
113 foreach(PACKAGE ${PACKAGELIST})
114 find_package(${PACKAGE} REQUIRED)
115 message(${PACKAGE}_FOUND)
116 if (${PACKAGE}_FOUND)
117 set(HAVE_LIB${PACKAGE} "1")
118 include_directories(${${PACKAGE}_INCLUDE_DIRS})
119 message(STATUS "${PACKAGE} include ${${PACKAGE}_INCLUDE_DIRS}")
120 message(STATUS "${PACKAGE} lib ${${PACKAGE}_LIBRARIES}")
124 # Hack for now: compat with current configure stuff
130 set(CPACK_PACKAGE_NAME wireshark)
131 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "capture packet")
132 set(CPACK_PACKAGE_VENDOR "wireshark")
133 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
134 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
135 set(CPACK_PACKAGE_VERSION_MAJOR "1")
136 set(CPACK_PACKAGE_VERSION_MINOR "3")
137 set(CPACK_PACKAGE_VERSION_PATCH "0")
138 set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
140 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
141 set(CPACK_PACKAGE_INSTALL_DIRECTORY "/usr")
142 set(CPACK_GENERATOR "TGZ")
143 set(CPACK_SOURCE_GENERATOR "TGZ")
145 include(ConfigureChecks.cmake)
147 #Big or little endian ?
148 include(TestBigEndian)
149 test_big_endian(WORDS_BIGENDIAN)
151 set(DATAFILE_DIR "${CMAKE_INSTALL_PREFIX}/share/${CPACK_PACKAGE_NAME}")
155 set(WS_VAR_IMPORT "extern")
159 #TODO verify that APPLE implies HAVE_OS_X_FRAMEWORKS
160 set(HAVE_OS_X_FRAMEWORKS 1)
164 add_definitions(-DHAVE_WIN32_LIBWIRESHARK_LIB -D_NEED_VAR_IMPORT_)
165 set(WS_VAR_IMPORT "__declspec(dllimport) extern")
167 # Disable deprecation
169 add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
174 add_subdirectory( epan )
175 add_subdirectory( gtk )
176 add_subdirectory( wiretap )
177 add_subdirectory( wsutil )
179 configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h)
188 link_directories( gtk )
192 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h
193 COMMAND ${PERL} ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
194 ${CMAKE_CURRENT_SOURCE_DIR}
196 SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/svnversion.h GENERATED)
198 # Create the necessary tools
203 # Do we need something here on any platform?
205 add_executable(lemon ${lemon_FILES})
206 target_link_libraries(lemon ${lemon_LIBS})
210 OUTPUT tshark-tap-register.c
212 ${CMAKE_SOURCE_DIR}/make-tapreg-dotc
213 tshark-tap-register.c
214 ${CMAKE_CURRENT_SOURCE_DIR}
217 ${CMAKE_SOURCE_DIR}/make-tapreg-dotc
223 COMMAND ${PYTHON_EXECUTABLE}
224 ${CMAKE_CURRENT_SOURCE_DIR}/rdps.py
225 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
228 ${CMAKE_CURRENT_SOURCE_DIR}/rdps.py
229 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
234 capture-pcap-util-unix.c
240 capture-wpcap.c capture_wpcap_packet.c
244 set(WIRESHARK_COMMON_SRC
295 # $(wireshark_optional_objects)
324 ${PORTAUDIO_LIBRARIES}
343 ${WIRESHARK_COMMON_SRC}
345 add_executable(wireshark ${wireshark_FILES})
346 target_link_libraries(wireshark ${wireshark_LIBS})
347 install(TARGETS wireshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
358 tshark-tap-register.c
361 ${WIRESHARK_COMMON_SRC}
363 add_executable(tshark ${tshark_FILES})
364 target_link_libraries(tshark ${tshark_LIBS})
365 install(TARGETS tshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
373 ${WIRESHARK_COMMON_SRC}
376 add_executable(rawshark ${rawshark_FILES})
377 target_link_libraries(rawshark ${rawshark_LIBS})
378 install(TARGETS rawshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
389 add_executable(dftest ${dftest_FILES})
390 target_link_libraries(dftest ${dftest_LIBS})
391 install(TARGETS dftest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
409 add_executable(randpkt ${randpkt_FILES})
410 target_link_libraries(randpkt ${randpkt_LIBS})
411 install(TARGETS randpkt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
424 add_lex_files(text2pcap_FILES
427 add_executable(text2pcap ${text2pcap_FILES})
428 target_link_libraries(text2pcap ${text2pcap_LIBS})
429 install(TARGETS text2pcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
443 add_executable(mergecap ${mergecap_FILES})
444 target_link_libraries(mergecap ${mergecap_LIBS})
445 install(TARGETS mergecap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
457 add_executable(capinfos ${capinfos_FILES})
458 target_link_libraries(capinfos ${capinfos_LIBS})
459 install(TARGETS capinfos RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
470 epan/crypt/crypt-md5.c
473 add_executable(editcap ${editcap_FILES})
474 target_link_libraries(editcap ${editcap_LIBS})
475 install(TARGETS editcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
497 capture_stop_conditions.c
508 add_executable(dumpcap ${dumpcap_FILES})
509 target_link_libraries(dumpcap ${dumpcap_LIBS})
510 install(TARGETS dumpcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})