summaryrefslogtreecommitdiffstats
path: root/wiretap/CMakeLists.txt
blob: 90c6ce12f7978bdb4e671b9528b0ca5d0985baa2 (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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# CMakeLists.txt
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
#
# SPDX-License-Identifier: GPL-2.0-or-later
#

set(WIRETAP_PUBLIC_HEADERS
	file_wrappers.h
	introspection.h
	merge.h
	pcap-encap.h
	pcapng_module.h
	secrets-types.h
	wtap.h
	wtap_modules.h
	wtap_opttypes.h
)

#
# Files that implement reading and possibly writing one or more
# file types.  (For cases where more than one source file is
# used, this should be the one that contains a registration routine.)
#
# This does not include libpcap.c and pcapng.c; those are listed below,
# and we don't scan them to see whether they have registration
# routines, we *require* them to have registration routines named
# register_pcap() and register_pcapng(), and directly call those routines.
#
set(WIRETAP_C_MODULE_FILES
	${CMAKE_CURRENT_SOURCE_DIR}/5views.c
	${CMAKE_CURRENT_SOURCE_DIR}/aethra.c
	${CMAKE_CURRENT_SOURCE_DIR}/ascendtext.c
	${CMAKE_CURRENT_SOURCE_DIR}/atm.c
	${CMAKE_CURRENT_SOURCE_DIR}/autosar_dlt.c
	${CMAKE_CURRENT_SOURCE_DIR}/ber.c
	${CMAKE_CURRENT_SOURCE_DIR}/blf.c
	${CMAKE_CURRENT_SOURCE_DIR}/btsnoop.c
	${CMAKE_CURRENT_SOURCE_DIR}/busmaster.c
	${CMAKE_CURRENT_SOURCE_DIR}/camins.c
	${CMAKE_CURRENT_SOURCE_DIR}/candump.c
	${CMAKE_CURRENT_SOURCE_DIR}/capsa.c
	${CMAKE_CURRENT_SOURCE_DIR}/catapult_dct2000.c
	${CMAKE_CURRENT_SOURCE_DIR}/commview.c
	${CMAKE_CURRENT_SOURCE_DIR}/cosine.c
	${CMAKE_CURRENT_SOURCE_DIR}/csids.c
	${CMAKE_CURRENT_SOURCE_DIR}/daintree-sna.c
	${CMAKE_CURRENT_SOURCE_DIR}/dbs-etherwatch.c
	${CMAKE_CURRENT_SOURCE_DIR}/dpa400.c
	${CMAKE_CURRENT_SOURCE_DIR}/dct3trace.c
	${CMAKE_CURRENT_SOURCE_DIR}/erf.c
	${CMAKE_CURRENT_SOURCE_DIR}/eri_enb_log.c
	${CMAKE_CURRENT_SOURCE_DIR}/eyesdn.c
	${CMAKE_CURRENT_SOURCE_DIR}/hcidump.c
	${CMAKE_CURRENT_SOURCE_DIR}/i4btrace.c
	${CMAKE_CURRENT_SOURCE_DIR}/ipfix.c
	${CMAKE_CURRENT_SOURCE_DIR}/iptrace.c
	${CMAKE_CURRENT_SOURCE_DIR}/iseries.c
	${CMAKE_CURRENT_SOURCE_DIR}/json.c
	${CMAKE_CURRENT_SOURCE_DIR}/k12.c
	${CMAKE_CURRENT_SOURCE_DIR}/lanalyzer.c
	${CMAKE_CURRENT_SOURCE_DIR}/log3gpp.c
	${CMAKE_CURRENT_SOURCE_DIR}/logcat.c
	${CMAKE_CURRENT_SOURCE_DIR}/logcat_text.c
	${CMAKE_CURRENT_SOURCE_DIR}/mp4.c
	${CMAKE_CURRENT_SOURCE_DIR}/mpeg.c
	${CMAKE_CURRENT_SOURCE_DIR}/mplog.c
	${CMAKE_CURRENT_SOURCE_DIR}/mime_file.c
	${CMAKE_CURRENT_SOURCE_DIR}/mp2t.c
	${CMAKE_CURRENT_SOURCE_DIR}/netmon.c
	${CMAKE_CURRENT_SOURCE_DIR}/netscaler.c
	${CMAKE_CURRENT_SOURCE_DIR}/netscreen.c
	${CMAKE_CURRENT_SOURCE_DIR}/nettl.c
	${CMAKE_CURRENT_SOURCE_DIR}/nettrace_3gpp_32_423.c
	${CMAKE_CURRENT_SOURCE_DIR}/netxray.c
	${CMAKE_CURRENT_SOURCE_DIR}/ngsniffer.c
	${CMAKE_CURRENT_SOURCE_DIR}/observer.c
	${CMAKE_CURRENT_SOURCE_DIR}/packetlogger.c
	${CMAKE_CURRENT_SOURCE_DIR}/pcap-common.c
	${CMAKE_CURRENT_SOURCE_DIR}/peekclassic.c
	${CMAKE_CURRENT_SOURCE_DIR}/peektagged.c
	${CMAKE_CURRENT_SOURCE_DIR}/pppdump.c
	${CMAKE_CURRENT_SOURCE_DIR}/radcom.c
	${CMAKE_CURRENT_SOURCE_DIR}/rfc7468.c
	${CMAKE_CURRENT_SOURCE_DIR}/rtpdump.c
	${CMAKE_CURRENT_SOURCE_DIR}/ruby_marshal.c
	${CMAKE_CURRENT_SOURCE_DIR}/snoop.c
	${CMAKE_CURRENT_SOURCE_DIR}/stanag4607.c
	${CMAKE_CURRENT_SOURCE_DIR}/systemd_journal.c
	${CMAKE_CURRENT_SOURCE_DIR}/tnef.c
	${CMAKE_CURRENT_SOURCE_DIR}/toshiba.c
	${CMAKE_CURRENT_SOURCE_DIR}/visual.c
	${CMAKE_CURRENT_SOURCE_DIR}/vms.c
	${CMAKE_CURRENT_SOURCE_DIR}/vwr.c
)

set(WIRETAP_LEX_MODULE_FILES
	${CMAKE_CURRENT_SOURCE_DIR}/k12text.l
)

#
# Files to scan for registration routines.
#
set(WIRETAP_MODULE_FILES
	${WIRETAP_C_MODULE_FILES}
	${WIRETAP_LEX_MODULE_FILES}
)

#
# C source files that aren't generated.
#
set(WIRETAP_NONGENERATED_C_FILES
	${WIRETAP_C_MODULE_FILES}
	${CMAKE_CURRENT_SOURCE_DIR}/pcapng.c
	${CMAKE_CURRENT_SOURCE_DIR}/introspection.c
	${CMAKE_CURRENT_SOURCE_DIR}/libpcap.c
	${CMAKE_CURRENT_SOURCE_DIR}/file_access.c
	${CMAKE_CURRENT_SOURCE_DIR}/file_wrappers.c
	${CMAKE_CURRENT_SOURCE_DIR}/merge.c
	${CMAKE_CURRENT_SOURCE_DIR}/wtap.c
	${CMAKE_CURRENT_SOURCE_DIR}/wtap_opttypes.c
)

#
# All C files to compile.
#
set(WIRETAP_FILES ${WIRETAP_NONGENERATED_C_FILES} wtap_modules.c)

add_lex_files(LEX_FILES WIRETAP_FILES
	${WIRETAP_LEX_MODULE_FILES}
	${CMAKE_CURRENT_SOURCE_DIR}/ascend_scanner.l
	${CMAKE_CURRENT_SOURCE_DIR}/busmaster_scanner.l
	${CMAKE_CURRENT_SOURCE_DIR}/candump_scanner.l
)

add_lemon_files(LEMON_FILES WIRETAP_FILES
	${CMAKE_CURRENT_SOURCE_DIR}/ascend_parser.lemon
	${CMAKE_CURRENT_SOURCE_DIR}/busmaster_parser.lemon
	${CMAKE_CURRENT_SOURCE_DIR}/candump_parser.lemon
)

#
# We pass the arguments to make-regs.py in a file to avoid limitations
# with the number of arguments handled by main().
#
file(GENERATE
	OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/wtap_modules.in.txt"
	CONTENT "$<JOIN:${WIRETAP_MODULE_FILES},\n>\n"
)
add_custom_command(
	OUTPUT wtap_modules.c
	COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/make-regs.py wtap_modules wtap_modules.c @wtap_modules.in.txt
	DEPENDS ${CMAKE_SOURCE_DIR}/tools/make-regs.py ${WIRETAP_MODULE_FILES}
		"${CMAKE_CURRENT_BINARY_DIR}/wtap_modules.in.txt"
	COMMENT "Making wtap_modules.c"
)

#
# All files are warning-clean.  (Let's keep it that way.)
#
set_source_files_properties(
	${WIRETAP_NONGENERATED_C_FILES}
	PROPERTIES
	COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)

add_library(wiretap
	${WIRETAP_FILES}
	${CMAKE_BINARY_DIR}/resources/libwiretap.rc
)

set_target_properties(wiretap PROPERTIES
	PREFIX "lib"
	COMPILE_DEFINITIONS "WS_BUILD_DLL"
	LINK_FLAGS "${WS_LINK_FLAGS}"
	VERSION "14.1.6" SOVERSION 14
	FOLDER "DLLs"
	INSTALL_RPATH "${LIBRARY_INSTALL_RPATH}"
)
if(MSVC)
	set_target_properties(wiretap PROPERTIES LINK_FLAGS_DEBUG "${WS_MSVC_DEBUG_LINK_FLAGS}")
endif()

target_link_libraries(wiretap
	PUBLIC
		wsutil
		${GLIB2_LIBRARIES}
	PRIVATE
		${ZLIB_LIBRARIES}
		${ZSTD_LIBRARIES}
		${LZ4_LIBRARIES}
)

target_include_directories(wiretap SYSTEM
	PRIVATE
		${ZLIB_INCLUDE_DIRS}
		${ZSTD_INCLUDE_DIRS}
		${LZ4_INCLUDE_DIRS}
)

target_include_directories(wiretap PUBLIC
	$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)

install(TARGETS wiretap
	EXPORT WiresharkTargets
	RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
	ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

install(FILES ${WIRETAP_PUBLIC_HEADERS}
	DESTINATION "${PROJECT_INSTALL_INCLUDEDIR}/wiretap"
	COMPONENT "Development"
	EXCLUDE_FROM_ALL
)

CHECKAPI(
	NAME
	  wiretap
	SWITCHES
	SOURCES
	  ${WIRETAP_NONGENERATED_FILES}
# LEX files commented out due to use of malloc, free etc.
#	  ${LEX_FILES}
	  ${LEMON_FILES}
)

#
# Editor modelines  -  https://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#