Rename "ws_version_info.h", also .c
[metze/wireshark/wip.git] / wiretap / CMakeLists.txt
1 # CMakeLists.txt
2 #
3 # Wireshark - Network traffic analyzer
4 # By Gerald Combs <gerald@wireshark.org>
5 # Copyright 1998 Gerald Combs
6 #
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
9 # as published by the Free Software Foundation; either version 2
10 # of the License, or (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21
22 include(UseABICheck)
23
24 set(WIRETAP_PUBLIC_HEADERS
25         file_wrappers.h
26         merge.h
27         pcap-encap.h
28         pcapng_module.h
29         wtap.h
30         wtap_opttypes.h
31 )
32
33 set(WIRETAP_FILES
34         5views.c
35         aethra.c
36         ascendtext.c
37         atm.c
38         ber.c
39         btsnoop.c
40         camins.c
41         capsa.c
42         catapult_dct2000.c
43         commview.c
44         cosine.c
45         csids.c
46         daintree-sna.c
47         dbs-etherwatch.c
48         dct3trace.c
49         erf.c
50         eyesdn.c
51         file_access.c
52         file_wrappers.c
53         hcidump.c
54         i4btrace.c
55         ipfix.c
56         iptrace.c
57         iseries.c
58         json.c
59         k12.c
60         lanalyzer.c
61         libpcap.c
62         logcat.c
63         logcat_text.c
64         merge.c
65         mpeg.c
66         mplog.c
67         mime_file.c
68         mp2t.c
69         netmon.c
70         netscaler.c
71         netscreen.c
72         nettl.c
73         nettrace_3gpp_32_423.c
74         network_instruments.c
75         netxray.c
76         ngsniffer.c
77         packetlogger.c
78         pcap-common.c
79         pcapng.c
80         peekclassic.c
81         peektagged.c
82         pppdump.c
83         radcom.c
84         snoop.c
85         stanag4607.c
86         tnef.c
87         toshiba.c
88         visual.c
89         vms.c
90         vwr.c
91         wtap.c
92         wtap_opttypes.c
93         ${CMAKE_SOURCE_DIR}/version_info.c
94 )
95
96 set_source_files_properties(
97         ${WIRETAP_FILES}
98         PROPERTIES
99         COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
100 )
101
102 add_lex_files(LEX_FILES GENERATED_FILES
103         ascend_scanner.l
104         k12text.l
105 )
106
107 add_yacc_files(YACC_FILES GENERATED_FILES
108         ascend.y
109 )
110
111 set(wiretap_LIBS
112         ${GLIB2_LIBRARIES}
113         ${GMODULE2_LIBRARIES}
114         ${ZLIB_LIBRARIES}
115         wsutil
116 )
117
118 add_library(wiretap ${LINK_MODE_LIB}
119         ${WIRETAP_FILES}
120         ${GENERATED_FILES}
121         ${CMAKE_BINARY_DIR}/image/wiretap.rc
122 )
123
124 add_dependencies(wiretap version)
125
126 set(FULL_SO_VERSION "0.0.0")
127
128 set_target_properties(wiretap PROPERTIES
129         PREFIX "lib"
130         COMPILE_DEFINITIONS "WS_BUILD_DLL"
131         COMPILE_OPTIONS "${WS_WARNINGS_C_FLAGS}"
132         LINK_FLAGS "${WS_LINK_FLAGS}"
133         VERSION ${FULL_SO_VERSION} SOVERSION 0
134         FOLDER "DLLs"
135 )
136
137 if(ENABLE_APPLICATION_BUNDLE)
138         set_target_properties(wiretap PROPERTIES
139                 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Frameworks
140         )
141 endif()
142
143 ABICHECK(libwiretap)
144
145 add_custom_command(OUTPUT libwiretap.abi.tar.gz
146         COMMAND ${CMAKE_COMMAND} -E remove_directory ${ABICHECK_TMPDIR}
147         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}
148         COMMAND ${ABI_COPY_COMMAND} ../config.h ${ABICHECK_TMPDIR}/ ${ABI_COPY_FLAGS}
149         COMMAND ${ABI_COPY_COMMAND} ${ABICHECK_HEADERS} ${ABICHECK_TMPDIR}/ ${ABI_COPY_FLAGS}
150         COMMAND ${ABICHECK_COMMAND}
151         COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps/libwiretap/libwiretap_* ${CMAKE_CURRENT_BINARY_DIR}/libwiretap.abi.tar.gz
152         COMMAND rm -rf ${ABICHECK_TMPDIR} ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps
153         DEPENDS ${HEADERS} wiretap)
154
155 target_link_libraries(wiretap ${wiretap_LIBS})
156
157 if(NOT ${ENABLE_STATIC})
158         install(TARGETS wiretap
159                 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
160                 RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
161                 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
162         )
163
164         if(NOT WIN32)
165                 install(FILES ${WIRETAP_PUBLIC_HEADERS}
166                         DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${CPACK_PACKAGE_NAME}/wiretap"
167                 )
168         endif()
169 endif()
170
171 CHECKAPI(
172         NAME
173           wiretap
174         SWITCHES
175 ## 'abort' checking disabled for now pending resolution of existing use of g_assert & g_error
176 ##        -g abort -g termoutput
177           -g termoutput -build
178         SOURCES
179           ${WIRETAP_FILES}
180 # LEX files commented out due to use of malloc, free etc.
181 #         ${LEX_FILES}
182           ${YACC_FILES}
183 )
184
185 #
186 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
187 #
188 # Local variables:
189 # c-basic-offset: 8
190 # tab-width: 8
191 # indent-tabs-mode: t
192 # End:
193 #
194 # vi: set shiftwidth=8 tabstop=8 noexpandtab:
195 # :indentSize=8:tabSize=8:noTabs=false:
196 #