aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: a3d5e6d85fc9667eb63ba73fb7d7674e87f9a0cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# 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.
#

project(wireshark C)

set(dumpcap_LIBS wiretap)

# Disable this later. Alternative: "make VERBOSE=1"
set(CMAKE_VERBOSE_MAKEFILE ON)

set(BUILD_SHARED_LIBS ON)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)

set(dumpcap_PLATFORM_SRC
	capture-pcap-util-unix.c
)

set(dumpcap_FILES
        capture_opts.c
        capture_loop.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

	${dumpcap_PLATFORM_SRC}
)

include_directories(${CMAKE_BINARY_DIR}
	${CMAKE_SOURCE_DIR}
	${CMAKE_SOURCE_DIR}/wiretap)

add_definitions(-DHAVE_CONFIG_H -D_U_=\"__attribute__\(\(unused\)\)\")

link_directories(wiretap)

add_executable(dumpcap ${dumpcap_FILES})

option(BUILD_WITH_GLIB2 "Build using gtk2/glib2 instead of gtk/glib" ON)
option(BUILD_WIRESHARK  "Build the GUI version of Wireshark" ON)
option(ENABLE_STATIC	"Build a static version of Wireshark" OFF)

if (BUILD_WITH_GLIB2)
	if (BUILD_WIRESHARK)
		find_package(GTK2 REQUIRED)
		if (GTK2_FOUND)
			message(GTK2_FOUND)
			include_directories(${GTK2_INCLUDE_DIR})
			# set(dumpcap_LIBS ${dumpcap_LIBS} ${GTK2_LIBRARIES})
		endif (GTK2_FOUND)
	endif (BUILD_WIRESHARK)
	find_package(GLIB2 REQUIRED)
	if (GLIB2_FOUND)
		message(GLIB2_FOUND)
		include_directories(${GLIB2_INCLUDE_DIR})
		set(dumpcap_LIBS ${dumpcap_LIBS} ${GLIB2_glib_LIBRARY})
	endif (GLIB2_FOUND)
else (BUILD_WITH_GLIB2)
	if (BUILD_WIRESHARK)
		find_package(GTK REQUIRED)
		if (GTK_FOUND)
			message(GTK_FOUND)
			include_directories(${GTK_INCLUDE_DIR})
			# set(dumpcap_LIBS ${dumpcap_LIBS} ${GTK_LIBRARIES})
		endif (GTK_FOUND)
	endif (BUILD_WIRESHARK)
	find_package(GLIB REQUIRED)
	if (GLIB_FOUND)
		message(GLIB_FOUND)
		include_directories(${GLIB_INCLUDE_DIR})
		set(dumpcap_LIBS ${dumpcap_LIBS} ${GLIB_glib_LIBRARIES})
	endif (GLIB_FOUND)
endif (BUILD_WITH_GLIB2)

set(PACKAGELIST ZLIB PCAP)

foreach(PACKAGE ${PACKAGELIST})
	find_package(${PACKAGE})
	message(${PACKAGE}_FOUND)
	if (${PACKAGE}_FOUND)
		include_directories(${${PACKAGE}_INCLUDE_DIR})
		set(dumpcap_LIBS ${dumpcap_LIBS} ${${PACKAGE}_LIBRARIES})
	endif (${PACKAGE}_FOUND)
endforeach(PACKAGE)

configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h)

target_link_libraries(dumpcap ${dumpcap_LIBS})