2006-09-05 09:50:45 +00:00
|
|
|
# CMakeLists.txt
|
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
# Wireshark - Network traffic analyzer
|
|
|
|
# By Gerald Combs <gerald@wireshark.org>
|
|
|
|
# Copyright 1998 Gerald Combs
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
#
|
|
|
|
|
2009-06-16 05:37:46 +00:00
|
|
|
|
2006-09-06 22:28:19 +00:00
|
|
|
project(wireshark C)
|
2006-09-05 09:27:22 +00:00
|
|
|
|
2009-06-16 05:37:46 +00:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
2009-06-16 04:12:30 +00:00
|
|
|
|
2009-06-16 05:37:46 +00:00
|
|
|
subdirs(
|
2009-06-15 18:59:33 +00:00
|
|
|
wiretap
|
|
|
|
wsutil
|
|
|
|
)
|
2006-09-05 09:27:22 +00:00
|
|
|
|
2006-10-26 15:36:50 +00:00
|
|
|
#Where to find local cmake scripts
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
|
|
|
|
|
2006-10-24 17:39:32 +00:00
|
|
|
# Under linux the release mode (CMAKE_BUILD_TYPE=release) defines NDEBUG
|
|
|
|
|
2006-09-13 10:51:40 +00:00
|
|
|
# Disable this later. Alternative: "make VERBOSE=1"
|
2006-09-06 22:28:19 +00:00
|
|
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
2006-09-13 10:51:40 +00:00
|
|
|
|
2006-09-06 22:28:19 +00:00
|
|
|
set(BUILD_SHARED_LIBS ON)
|
2006-09-05 09:27:22 +00:00
|
|
|
|
2006-10-26 15:36:50 +00:00
|
|
|
#Defines CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_DATADIR, etc ...
|
|
|
|
include(CMakeInstallDirs)
|
2006-09-05 09:27:22 +00:00
|
|
|
|
2006-10-26 15:36:50 +00:00
|
|
|
include_directories(
|
|
|
|
${CMAKE_BINARY_DIR}
|
|
|
|
${CMAKE_SOURCE_DIR}
|
|
|
|
${CMAKE_SOURCE_DIR}/include
|
|
|
|
${CMAKE_SOURCE_DIR}/wiretap
|
2009-06-15 18:59:33 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/wsutil
|
2006-10-26 15:36:50 +00:00
|
|
|
)
|
2006-09-05 09:27:22 +00:00
|
|
|
|
2006-10-24 17:39:32 +00:00
|
|
|
#Where to put libraries
|
|
|
|
if(NOT LIBRARY_OUTPUT_PATH)
|
|
|
|
set(LIBRARY_OUTPUT_PATH ${wireshark_BINARY_DIR}/lib CACHE INTERNAL
|
|
|
|
"Single output directory for building all libraries.")
|
|
|
|
endif(NOT LIBRARY_OUTPUT_PATH)
|
|
|
|
|
|
|
|
option(BUILD_WIRESHARK "Build the GUI version of Wireshark" ON)
|
|
|
|
option(BUILD_TSHARK "Build tshark" ON)
|
2009-06-16 05:37:46 +00:00
|
|
|
option(BUILD_RAWSHARK "Build rawshark" ON)
|
2009-06-16 05:52:16 +00:00
|
|
|
option(BUILD_dumpcap "Build dumpcap" ON)
|
|
|
|
option(BUILD_text2pcap "Build text2pcap" ON)
|
|
|
|
option(BUILD_mergecap "Build mergecap" ON)
|
|
|
|
option(BUILD_editcap "Build editcap" ON)
|
|
|
|
option(BUILD_capinfos "Build capinfos" ON)
|
2009-06-16 05:37:46 +00:00
|
|
|
option(BUILD_dftest "Build dftest" ON)
|
2006-10-24 17:39:32 +00:00
|
|
|
option(ENABLE_STATIC "Build a static version of Wireshark" OFF)
|
2009-06-16 05:37:46 +00:00
|
|
|
option(ENABLE_ADNS "Build with adns support" ON)
|
2006-10-26 15:36:50 +00:00
|
|
|
option(ENABLE_EXTRA_GCC_CHECKS "Do additional -W checks in GCC" OFF)
|
|
|
|
|
|
|
|
if(ENABLE_EXTRA_GCC_CHECKS)
|
|
|
|
set(WIRESHARK_EXTRA_GCC_FLAGS -Wcast-qual -Wcast-align -Wbad-function-cast
|
|
|
|
-pedantic -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings)
|
|
|
|
endif(ENABLE_EXTRA_GCC_CHECKS)
|
|
|
|
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
add_definitions(
|
|
|
|
-DHAVE_CONFIG_H
|
2009-05-29 10:57:47 +00:00
|
|
|
-D_U_=__attribute__\(\(unused\)\)
|
2006-10-26 15:36:50 +00:00
|
|
|
-Wall -Wpointer-arith -W
|
|
|
|
${WIRESHARK_EXTRA_GCC_FLAGS}
|
|
|
|
)
|
|
|
|
else(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
add_definitions(-DHAVE_CONFIG_H -D_U_=\"\")
|
|
|
|
endif(CMAKE_COMPILER_IS_GNUCC)
|
2006-10-24 17:39:32 +00:00
|
|
|
|
|
|
|
#The minimum package list
|
2009-06-16 05:52:16 +00:00
|
|
|
set(PACKAGELIST GLIB2 ZLIB PCAP LEX YACC Perl ${PACKAGELIST})
|
2006-10-24 17:39:32 +00:00
|
|
|
|
|
|
|
#build the gui ?
|
|
|
|
if(BUILD_WIRESHARK)
|
|
|
|
set(PACKAGELIST GTK2 ${PACKAGELIST})
|
|
|
|
endif(BUILD_WIRESHARK)
|
|
|
|
|
|
|
|
#Gnu asynchronous dns
|
|
|
|
if(ENABLE_ADNS)
|
|
|
|
set(PACKAGELIST ADNS ${PACKAGELIST})
|
|
|
|
set(HAVE_GNU_ADNS 1)
|
|
|
|
endif(ENABLE_ADNS)
|
|
|
|
|
2009-06-16 05:52:16 +00:00
|
|
|
set(PROGLIST text2pcap mergecap capinfos editcap dumpcap)
|
2009-06-16 05:37:46 +00:00
|
|
|
|
2006-10-24 17:39:32 +00:00
|
|
|
#Let's loop the package list
|
2006-09-06 22:28:19 +00:00
|
|
|
foreach(PACKAGE ${PACKAGELIST})
|
2006-10-24 17:39:32 +00:00
|
|
|
find_package(${PACKAGE} REQUIRED)
|
|
|
|
message(${PACKAGE}_FOUND)
|
|
|
|
if (${PACKAGE}_FOUND)
|
|
|
|
set(HAVE_LIB${PACKAGE} "1")
|
|
|
|
include_directories(${${PACKAGE}_INCLUDE_DIRS})
|
|
|
|
message(STATUS "${PACKAGE} include ${${PACKAGE}_INCLUDE_DIRS}")
|
2009-06-16 05:37:46 +00:00
|
|
|
foreach(PROG ${PROGLIST})
|
|
|
|
# set(${PROG}_LIBS ${${PROG}_LIBS} ${${PACKAGE}_LIBRARIES})
|
|
|
|
endforeach(PROG)
|
2006-10-24 17:39:32 +00:00
|
|
|
message(STATUS "${PACKAGE} lib ${${PACKAGE}_LIBRARIES}")
|
|
|
|
endif (${PACKAGE}_FOUND)
|
2006-09-06 22:28:19 +00:00
|
|
|
endforeach(PACKAGE)
|
|
|
|
|
2007-10-28 23:49:15 +00:00
|
|
|
#subdirs(dbus)
|
|
|
|
|
2006-10-24 17:39:32 +00:00
|
|
|
#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")
|
2006-10-26 15:36:50 +00:00
|
|
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
|
2009-06-15 18:59:33 +00:00
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR "1")
|
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR "3")
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH "0")
|
2006-10-24 17:39:32 +00:00
|
|
|
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")
|
|
|
|
|
2009-08-27 15:32:57 +00:00
|
|
|
include(ConfigureChecks.cmake)
|
2006-10-24 17:39:32 +00:00
|
|
|
|
|
|
|
#Big or little endian ?
|
|
|
|
include(TestBigEndian)
|
|
|
|
test_big_endian(WORDS_BIGENDIAN)
|
|
|
|
|
|
|
|
set(DATAFILE_DIR "${CMAKE_INSTALL_PREFIX}/share/${CPACK_PACKAGE_NAME}")
|
|
|
|
|
|
|
|
#64 Bit format
|
|
|
|
include(Check64BitFormat)
|
|
|
|
|
|
|
|
check_64bit_format(ll FORMAT_64BIT)
|
|
|
|
check_64bit_format(L FORMAT_64BIT)
|
|
|
|
check_64bit_format(q FORMAT_64BIT)
|
|
|
|
check_64bit_format(I64 FORMAT_64BIT)
|
|
|
|
|
|
|
|
if(NOT FORMAT_64BIT)
|
2006-10-26 15:36:50 +00:00
|
|
|
message(FATAL " 64 bit format missing")
|
2006-10-24 17:39:32 +00:00
|
|
|
endif(NOT FORMAT_64BIT)
|
|
|
|
|
|
|
|
set(PRIX64 "${FORMAT_64BIT}X")
|
|
|
|
set(PRIx64 "${FORMAT_64BIT}x")
|
|
|
|
set(PRId64 "${FORMAT_64BIT}d")
|
|
|
|
set(PRIo64 "${FORMAT_64BIT}o")
|
|
|
|
set(PRIu64 "${FORMAT_64BIT}u")
|
|
|
|
|
|
|
|
#Platform specific
|
|
|
|
if(UNIX)
|
|
|
|
set(WS_VAR_IMPORT "extern")
|
|
|
|
endif(UNIX)
|
|
|
|
|
|
|
|
if(APPLE)
|
|
|
|
#TODO verify that APPLE implies HAVE_OS_X_FRAMEWORKS
|
|
|
|
set(HAVE_OS_X_FRAMEWORKS 1)
|
|
|
|
endif(APPLE)
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
add_definitions(-DHAVE_WIN32_LIBWIRESHARK_LIB -D_NEED_VAR_IMPORT_)
|
|
|
|
set(WS_VAR_IMPORT "__declspec(dllimport) extern")
|
|
|
|
endif(WIN32)
|
|
|
|
|
|
|
|
|
2006-09-06 22:28:19 +00:00
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h)
|
|
|
|
|
2009-06-15 18:59:33 +00:00
|
|
|
link_directories(
|
|
|
|
wiretap
|
|
|
|
wsutil
|
|
|
|
)
|
2006-10-24 17:39:32 +00:00
|
|
|
|
2009-05-29 10:57:47 +00:00
|
|
|
ADD_CUSTOM_COMMAND(
|
|
|
|
OUTPUT ${CMAKE_BINARY_DIR}/svnversion.h
|
2009-06-16 05:52:16 +00:00
|
|
|
COMMAND ${PERL} ${CMAKE_SOURCE_DIR}/make-version.pl
|
2009-05-29 10:57:47 +00:00
|
|
|
ARGS
|
|
|
|
${CMAKE_SOURCE_DIR}
|
|
|
|
)
|
|
|
|
SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/svnversion.h GENERATED)
|
2006-10-24 17:39:32 +00:00
|
|
|
|
2009-06-16 04:12:30 +00:00
|
|
|
if(UNIX)
|
2009-06-16 05:37:46 +00:00
|
|
|
set(PLATFORM_SRC
|
|
|
|
capture-pcap-util-unix.c
|
2006-10-24 17:39:32 +00:00
|
|
|
)
|
2009-06-16 04:12:30 +00:00
|
|
|
endif(UNIX)
|
|
|
|
|
2009-06-16 05:37:46 +00:00
|
|
|
if(BUILD_WIRESHARK)
|
|
|
|
# todo
|
|
|
|
endif(BUILD_WIRESHARK)
|
|
|
|
|
|
|
|
if(BUILD_TSHARK)
|
|
|
|
# todo
|
|
|
|
endif(BUILD_TSHARK)
|
2006-10-24 17:39:32 +00:00
|
|
|
|
2009-06-16 05:37:46 +00:00
|
|
|
if(BUILD_RAWSHARK)
|
|
|
|
# todo
|
|
|
|
endif(BUILD_RAWSHARK)
|
|
|
|
|
2009-06-16 05:52:16 +00:00
|
|
|
if(BUILD_text2pcap)
|
|
|
|
set(text2pcap_LIBS
|
2009-06-16 05:37:46 +00:00
|
|
|
wiretap
|
|
|
|
wsutil
|
|
|
|
${GLIB2_LIBRARIES}
|
|
|
|
)
|
2009-06-16 05:52:16 +00:00
|
|
|
set(text2pcap_FILES
|
2009-06-16 05:37:46 +00:00
|
|
|
text2pcap.c
|
|
|
|
)
|
2009-06-16 05:52:16 +00:00
|
|
|
add_lex_files(text2pcap_FILES
|
2009-06-16 05:37:46 +00:00
|
|
|
text2pcap-scanner.l
|
|
|
|
)
|
2009-06-16 05:52:16 +00:00
|
|
|
add_executable(text2pcap ${text2pcap_FILES})
|
|
|
|
target_link_libraries(text2pcap ${text2pcap_LIBS})
|
2009-06-16 05:37:46 +00:00
|
|
|
install(TARGETS text2pcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
2009-06-16 05:52:16 +00:00
|
|
|
endif(BUILD_text2pcap)
|
2009-06-16 05:37:46 +00:00
|
|
|
|
2009-06-16 05:52:16 +00:00
|
|
|
if(BUILD_mergecap)
|
|
|
|
set(mergecap_LIBS
|
2009-06-16 05:37:46 +00:00
|
|
|
wiretap
|
|
|
|
wsutil
|
|
|
|
${GLIB2_LIBRARIES}
|
|
|
|
)
|
2009-06-16 05:52:16 +00:00
|
|
|
set(mergecap_FILES
|
2009-06-16 05:37:46 +00:00
|
|
|
mergecap.c
|
|
|
|
merge.c
|
|
|
|
svnversion.h
|
|
|
|
)
|
2009-06-16 05:52:16 +00:00
|
|
|
add_executable(mergecap ${mergecap_FILES})
|
|
|
|
target_link_libraries(mergecap ${mergecap_LIBS})
|
2009-06-16 05:37:46 +00:00
|
|
|
install(TARGETS mergecap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
2009-06-16 05:52:16 +00:00
|
|
|
endif(BUILD_mergecap)
|
2009-06-16 05:37:46 +00:00
|
|
|
|
2009-06-16 05:52:16 +00:00
|
|
|
if(BUILD_capinfos)
|
|
|
|
set(capinfos_LIBS
|
2009-06-16 05:37:46 +00:00
|
|
|
wiretap
|
|
|
|
wsutil
|
|
|
|
${GLIB2_LIBRARIES}
|
|
|
|
)
|
2009-06-16 05:52:16 +00:00
|
|
|
set(capinfos_FILES
|
2009-06-16 05:37:46 +00:00
|
|
|
capinfos.c
|
|
|
|
)
|
2009-06-16 05:52:16 +00:00
|
|
|
add_executable(capinfos ${capinfos_FILES})
|
|
|
|
target_link_libraries(capinfos ${capinfos_LIBS})
|
2009-06-16 05:37:46 +00:00
|
|
|
install(TARGETS capinfos RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
2009-06-16 05:52:16 +00:00
|
|
|
endif(BUILD_capinfos)
|
2009-06-16 05:37:46 +00:00
|
|
|
|
2009-06-16 05:52:16 +00:00
|
|
|
if(BUILD_editcap)
|
|
|
|
set(editcap_LIBS
|
2009-06-16 05:37:46 +00:00
|
|
|
wiretap
|
|
|
|
wsutil
|
|
|
|
${GLIB2_LIBRARIES}
|
|
|
|
)
|
2009-06-16 05:52:16 +00:00
|
|
|
set(editcap_FILES
|
2009-06-16 05:37:46 +00:00
|
|
|
editcap.c
|
|
|
|
epan/crypt/crypt-md5.c
|
|
|
|
epan/nstime.c
|
|
|
|
)
|
2009-06-16 05:52:16 +00:00
|
|
|
add_executable(editcap ${editcap_FILES})
|
|
|
|
target_link_libraries(editcap ${editcap_LIBS})
|
2009-06-16 05:37:46 +00:00
|
|
|
install(TARGETS editcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
2009-06-16 05:52:16 +00:00
|
|
|
endif(BUILD_editcap)
|
2009-06-16 05:37:46 +00:00
|
|
|
|
|
|
|
if(BUILD_RANDPKT)
|
|
|
|
# todo
|
|
|
|
endif(BUILD_RANDPKT)
|
|
|
|
|
|
|
|
if(BUILD_DFTEST)
|
|
|
|
# todo
|
|
|
|
endif(BUILD_DFTEST)
|
|
|
|
|
2009-06-16 05:52:16 +00:00
|
|
|
if(BUILD_dumpcap)
|
|
|
|
set(dumpcap_LIBS
|
2009-06-16 05:37:46 +00:00
|
|
|
wiretap
|
|
|
|
wsutil
|
|
|
|
${GLIB2_LIBRARIES}
|
|
|
|
${PCAP_LIBRARIES}
|
|
|
|
)
|
2009-06-16 05:52:16 +00:00
|
|
|
set(dumpcap_FILES
|
2009-05-29 10:57:47 +00:00
|
|
|
svnversion.h
|
|
|
|
capture_opts.c
|
|
|
|
capture-pcap-util.c
|
|
|
|
capture_stop_conditions.c
|
|
|
|
clopts_common.c
|
|
|
|
conditions.c
|
|
|
|
dumpcap.c
|
|
|
|
pcapio.c
|
|
|
|
ringbuffer.c
|
|
|
|
sync_pipe_write.c
|
|
|
|
tempfile.c
|
|
|
|
version_info.c
|
2009-06-16 05:37:46 +00:00
|
|
|
${PLATFORM_SRC}
|
2006-10-24 17:39:32 +00:00
|
|
|
)
|
2009-06-16 05:52:16 +00:00
|
|
|
add_executable(dumpcap ${dumpcap_FILES})
|
|
|
|
target_link_libraries(dumpcap ${dumpcap_LIBS})
|
2009-06-16 05:37:46 +00:00
|
|
|
install(TARGETS dumpcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
2009-06-16 05:52:16 +00:00
|
|
|
endif(BUILD_dumpcap)
|