From Ed Beroset via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9330:
[metze/wireshark/wip.git] / wsutil / CMakeLists.txt
1 # CMakeLists.txt
2 #
3 # $Id$
4 #
5 # Wireshark - Network traffic analyzer
6 # By Gerald Combs <gerald@wireshark.org>
7 # Copyright 1998 Gerald Combs
8 #
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.
13 #
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.
18 #
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #
23
24 include(UseABICheck)
25
26 IF(WIN32)
27   set(WSUTIL_PLATFORM_FILES
28     file_util.c
29     inet_aton.c
30     inet_ntop.c
31     inet_pton.c
32     strptime.c
33     unicode-utils.c
34     wsgetopt.c
35   )
36 ENDIF(WIN32)
37
38 set(WSUTIL_FILES
39   aes.c
40   airpdcap_wep.c
41   crash_info.c
42   crc10.c
43   crc16.c
44   crc16-plain.c
45   crc32.c
46   crc6.c
47   crc7.c
48   crc8.c
49   crc11.c
50   crcdrm.c
51   des.c
52   eax.c
53   g711.c
54   md4.c
55   md5.c
56   mpeg-audio.c
57   nstime.c
58   privileges.c
59   sha1.c
60   strnatcmp.c
61   str_util.c
62   rc4.c
63   report_err.c
64   swar.c
65   tempfile.c
66   type_util.c
67   u3.c
68   ${WSUTIL_PLATFORM_FILES}
69 )
70
71 set(wsutil_LIBS
72   ${GMODULE2_LIBRARIES}
73   ${GLIB2_LIBRARIES}
74   ${GCRYPT_LIBRARIES}
75   ${WIN_WSOCK32_LIBRARY}
76 )
77 IF(WIN32)
78   set(wsutil_LIBS ${wsutil_LIBS} "ws2_32.lib")
79 ENDIF(WIN32)
80
81 set(CLEAN_FILES
82   ${WSUTIL_FILES}
83 )
84
85 if (WERROR)
86   set_source_files_properties(
87     ${CLEAN_FILES}
88     PROPERTIES
89     COMPILE_FLAGS -Werror
90   )
91 endif()
92
93 add_library(wsutil ${LINK_MODE_LIB}
94   ${WSUTIL_FILES}
95 )
96
97 set(FULL_SO_VERSION "0.0.0")
98
99 set_target_properties(wsutil PROPERTIES COMPILE_DEFINITIONS "WS_BUILD_DLL")
100 set_target_properties(wsutil PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
101 set_target_properties(wsutil PROPERTIES VERSION ${FULL_SO_VERSION} SOVERSION 0)
102 set_target_properties(wsutil PROPERTIES FOLDER "DLLs")
103
104 ABICHECK(libwsutil)
105
106 add_custom_command(OUTPUT libwsutil.abi.tar.gz
107         COMMAND cp ../config.h ${ABICHECK_TMPDIR}/
108         COMMAND ${ABICHECK_COMMAND}
109         COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps/libwsutil/libwsutil_* ${CMAKE_CURRENT_BINARY_DIR}/libwsutil.abi.tar.gz
110         COMMAND rm -rf ${ABICHECK_TMPDIR}/* ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps
111         DEPENDS ${HEADERS} wsutil)
112
113 target_link_libraries(wsutil ${wsutil_LIBS})
114
115 if(NOT ${ENABLE_STATIC})
116         install(TARGETS wsutil
117                 LIBRARY DESTINATION lib
118                 RUNTIME DESTINATION lib
119                 ARCHIVE DESTINATION lib
120         )
121 endif()
122