2 add_library ( mod_auth_ao MODULE authorization/ao/ao.cpp )
3 target_link_libraries ( mod_auth_ao scriptexecuter logger common )
4 set_target_properties ( mod_auth_ao PROPERTIES PREFIX "" )
7 set_target_properties ( mod_auth_ao PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
9 if ( INCLUDE_WHAT_YOU_USE_EXE )
10 set_target_properties ( mod_auth_ao PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
12 endif ( BUILD_MOD_AO )
14 if ( BUILD_MOD_RADIUS )
15 find_package ( Boost REQUIRED )
17 add_library ( mod_radius MODULE other/radius/radius.cpp )
18 target_link_libraries ( mod_radius PRIVATE scriptexecuter logger common )
19 set_target_properties ( mod_radius PROPERTIES PREFIX "" )
21 include ( ExternalProject )
23 ExternalProject_Add ( async-radius
24 GIT_REPOSITORY https://github.com/madf/async-radius.git
28 CMAKE_ARGS -DCMAKE_CXX_FLAGS=-fPIC )
30 ExternalProject_Get_property ( async-radius SOURCE_DIR BINARY_DIR )
32 target_include_directories ( mod_radius PRIVATE "${SOURCE_DIR}/include" )
33 target_link_directories ( mod_radius PRIVATE "${BINARY_DIR}/src" )
35 add_dependencies ( mod_radius async-radius )
37 target_link_libraries ( mod_radius PRIVATE radproto Boost::boost )
40 set_target_properties ( mod_radius PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
42 if ( INCLUDE_WHAT_YOU_USE_EXE )
43 set_target_properties ( mod_radius PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
45 endif ( BUILD_MOD_RADIUS )
48 add_library ( mod_auth_ia MODULE authorization/inetaccess/inetaccess.cpp )
49 target_link_libraries ( mod_auth_ia scriptexecuter crypto logger common )
50 set_target_properties ( mod_auth_ia PROPERTIES PREFIX "" )
51 if ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
52 set_target_properties ( mod_auth_ia PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" )
53 endif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
56 set_target_properties ( mod_auth_ia PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
58 if ( INCLUDE_WHAT_YOU_USE_EXE )
59 set_target_properties ( mod_auth_ia PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
61 endif ( BUILD_MOD_IA )
63 if ( BUILD_MOD_CAP_NF )
64 add_library ( mod_cap_nf MODULE capture/cap_nf/cap_nf.cpp )
65 target_link_libraries ( mod_cap_nf logger common )
66 set_target_properties ( mod_cap_nf PROPERTIES PREFIX "" )
69 set_target_properties ( mod_cap_nf PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
71 if ( INCLUDE_WHAT_YOU_USE_EXE )
72 set_target_properties ( mod_cap_nf PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
74 endif ( BUILD_MOD_CAP_NF )
76 if ( BUILD_MOD_CAP_DIVERT )
77 add_library ( mod_cap_divert MODULE capture/divert_freebsd/divert_cap.cpp )
78 target_link_libraries ( mod_cap_divert logger common )
79 set_target_properties ( mod_cap_divert PROPERTIES PREFIX "" )
82 set_target_properties ( mod_cap_divert PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
84 if ( INCLUDE_WHAT_YOU_USE_EXE )
85 set_target_properties ( mod_cap_divert PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
87 endif ( BUILD_MOD_CAP_DIVERT )
89 if ( BUILD_MOD_CAP_ETHER_FREEBSD )
90 add_library ( mod_cap_bpf MODULE capture/ether_freebsd/ether_cap.cpp )
91 target_link_libraries ( mod_cap_bpf logger common )
92 set_target_properties ( mod_cap_bpf PROPERTIES PREFIX "" )
95 set_target_properties ( mod_cap_bpf PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
97 if ( INCLUDE_WHAT_YOU_USE_EXE )
98 set_target_properties ( mod_cap_bpf PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
100 endif ( BUILD_MOD_CAP_ETHER_FREEBSD )
102 if ( BUILD_MOD_CAP_ETHER_LINUX )
103 add_library ( mod_cap_ether MODULE capture/ether_linux/ether_cap.cpp )
104 target_link_libraries ( mod_cap_ether logger common )
105 set_target_properties ( mod_cap_ether PROPERTIES PREFIX "" )
107 if ( CLANG_TIDY_EXE )
108 set_target_properties ( mod_cap_ether PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
110 if ( INCLUDE_WHAT_YOU_USE_EXE )
111 set_target_properties ( mod_cap_ether PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
113 endif ( BUILD_MOD_CAP_ETHER_LINUX )
115 if ( BUILD_MOD_CAP_PCAP )
116 find_package ( PCap REQUIRED )
117 add_library ( mod_cap_pcap MODULE capture/pcap/pcap_cap.cpp )
118 target_link_libraries ( mod_cap_pcap logger common PCap::PCap )
119 set_target_properties ( mod_cap_pcap PROPERTIES PREFIX "" )
121 if ( CLANG_TIDY_EXE )
122 set_target_properties ( mod_cap_pcap PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
124 if ( INCLUDE_WHAT_YOU_USE_EXE )
125 set_target_properties ( mod_cap_pcap PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
127 endif ( BUILD_MOD_CAP_PCAP )
129 if ( BUILD_MOD_CAP_NFQUEUE )
130 find_package ( NFQueue REQUIRED )
131 find_package ( NFNetLink REQUIRED )
132 find_package ( MNL REQUIRED )
133 add_library ( mod_cap_nfqueue MODULE capture/nfqueue/nfqueue.cpp )
134 target_link_libraries ( mod_cap_nfqueue logger common NF::Queue NF::NetLink MNL::MNL )
135 set_target_properties ( mod_cap_nfqueue PROPERTIES PREFIX "" )
137 if ( CLANG_TIDY_EXE )
138 set_target_properties ( mod_cap_nfqueue PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
140 if ( INCLUDE_WHAT_YOU_USE_EXE )
141 set_target_properties ( mod_cap_nfqueue PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
143 endif ( BUILD_MOD_CAP_NFQUEUE )
145 if ( BUILD_MOD_SGCONFIG )
146 find_package ( EXPAT REQUIRED )
147 add_library ( mod_conf_sg MODULE configuration/sgconfig/stgconfig.cpp
148 configuration/sgconfig/conn.cpp
149 configuration/sgconfig/configproto.cpp
150 configuration/sgconfig/parser.cpp
151 configuration/sgconfig/parser_tariffs.cpp
152 configuration/sgconfig/parser_admins.cpp
153 configuration/sgconfig/parser_users.cpp
154 configuration/sgconfig/parser_services.cpp
155 configuration/sgconfig/parser_message.cpp
156 configuration/sgconfig/parser_auth_by.cpp
157 configuration/sgconfig/parser_user_info.cpp
158 configuration/sgconfig/parser_server_info.cpp )
159 target_link_libraries ( mod_conf_sg scriptexecuter crypto logger common EXPAT::EXPAT )
160 set_target_properties ( mod_conf_sg PROPERTIES PREFIX "" )
161 if ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
162 set_target_properties ( mod_conf_sg PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" )
163 endif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
165 if ( CLANG_TIDY_EXE )
166 set_target_properties ( mod_conf_sg PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
168 if ( INCLUDE_WHAT_YOU_USE_EXE )
169 set_target_properties ( mod_conf_sg PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
171 endif ( BUILD_MOD_SGCONFIG )
173 if ( BUILD_MOD_RPCCONFIG )
174 find_package ( XMLRPC 1.58.0 REQUIRED c++2 abyss-server )
175 try_compile ( XMLRPC_C_NO_AUTO_PTR ${CMAKE_CURRENT_BINARY_DIR} "${PROJECT_SOURCE_DIR}/checks/xmlrpc-c-auto_ptr.cpp" CMAKE_FLAGS -DINCLUDE_DIRECTORIES=${XMLRPC_INCLUDE_DIRS} LINK_LIBRARIES ${XMLRPC_LIBRARIES} OUTPUT_VARIABLE TRY_COMPILE_OUTPUT )
176 if ( NOT XMLRPC_C_NO_AUTO_PTR )
177 message ( WARNING ${TRY_COMPILE_OUTPUT} )
178 message ( FATAL_ERROR "Your version of XMLRPC-C library can not be used with C++17. Try upgrading to at least 1.58.0." )
180 include_directories ( ${XMLRPC_INCLUDE_DIRS} )
181 add_library ( mod_conf_rpc MODULE configuration/rpcconfig/rpcconfig.cpp
182 configuration/rpcconfig/user_helper.cpp
183 configuration/rpcconfig/tariff_helper.cpp
184 configuration/rpcconfig/info_methods.cpp
185 configuration/rpcconfig/users_methods.cpp
186 configuration/rpcconfig/tariffs_methods.cpp
187 configuration/rpcconfig/admins_methods.cpp
188 configuration/rpcconfig/messages_methods.cpp )
189 target_link_libraries ( mod_conf_rpc scriptexecuter logger common ${XMLRPC_LIBRARIES} )
190 set_target_properties ( mod_conf_rpc PROPERTIES PREFIX "" )
191 if ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
192 set_target_properties ( mod_conf_rpc PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" )
193 endif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
195 if ( CLANG_TIDY_EXE )
196 set_target_properties ( mod_conf_rpc PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
198 if ( INCLUDE_WHAT_YOU_USE_EXE )
199 set_target_properties ( mod_conf_rpc PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
201 endif ( BUILD_MOD_RPCCONFIG )
203 if ( BUILD_MOD_PING )
204 add_library ( mod_ping MODULE other/ping/ping.cpp )
205 target_link_libraries ( mod_ping scriptexecuter logger pinger common )
206 set_target_properties ( mod_ping PROPERTIES PREFIX "" )
208 if ( CLANG_TIDY_EXE )
209 set_target_properties ( mod_ping PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
211 if ( INCLUDE_WHAT_YOU_USE_EXE )
212 set_target_properties ( mod_ping PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
214 endif ( BUILD_MOD_PING )
216 if ( BUILD_MOD_RSCRYPT )
217 add_library ( mod_remote_script MODULE other/rscript/rscript.cpp other/rscript/nrmap_parser.cpp )
218 target_link_libraries ( mod_remote_script crypto scriptexecuter logger common )
219 set_target_properties ( mod_remote_script PROPERTIES PREFIX "" )
220 if ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
221 set_target_properties ( mod_remote_script PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" )
222 endif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
224 if ( CLANG_TIDY_EXE )
225 set_target_properties ( mod_remote_script PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
227 if ( INCLUDE_WHAT_YOU_USE_EXE )
228 set_target_properties ( mod_remote_script PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
230 endif ( BUILD_MOD_RSCRYPT )
232 if ( BUILD_MOD_SMUX )
233 add_library ( mod_smux MODULE other/smux/smux.cpp
234 other/smux/sensors.cpp
235 other/smux/tables.cpp
236 other/smux/handlers.cpp
238 other/smux/types.cpp )
239 target_link_libraries ( mod_smux scriptexecuter logger smux common )
240 set_target_properties ( mod_smux PROPERTIES PREFIX "" )
242 if ( CLANG_TIDY_EXE )
243 set_target_properties ( mod_smux PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
245 if ( INCLUDE_WHAT_YOU_USE_EXE )
246 set_target_properties ( mod_smux PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
248 endif ( BUILD_MOD_SMUX )
250 if ( BUILD_MOD_STORE_FILES )
251 add_library ( mod_store_files MODULE store/files/file_store.cpp )
252 target_link_libraries ( mod_store_files crypto conffiles logger common )
253 set_target_properties ( mod_store_files PROPERTIES PREFIX "" )
255 if ( CLANG_TIDY_EXE )
256 set_target_properties ( mod_store_files PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
258 if ( INCLUDE_WHAT_YOU_USE_EXE )
259 set_target_properties ( mod_store_files PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
261 endif ( BUILD_MOD_STORE_FILES )
263 if ( BUILD_MOD_STORE_FIREBIRD )
264 find_package ( FBClient REQUIRED )
265 add_library ( mod_store_firebird MODULE store/firebird/firebird_store.cpp
266 store/firebird/firebird_store_admins.cpp
267 store/firebird/firebird_store_corporations.cpp
268 store/firebird/firebird_store_messages.cpp
269 store/firebird/firebird_store_services.cpp
270 store/firebird/firebird_store_tariffs.cpp
271 store/firebird/firebird_store_users.cpp
272 store/firebird/firebird_store_utils.cpp )
273 target_link_libraries ( mod_store_firebird crypto common logger ibpp FBClient::FBClient )
274 set_target_properties ( mod_store_firebird PROPERTIES PREFIX "" )
276 if ( CLANG_TIDY_EXE )
277 set_target_properties ( mod_store_firebird PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
279 if ( INCLUDE_WHAT_YOU_USE_EXE )
280 set_target_properties ( mod_store_firebird PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
282 endif ( BUILD_MOD_STORE_FIREBIRD )
284 if ( BUILD_MOD_STORE_MYSQL )
285 find_package ( MySQLConnector REQUIRED )
286 add_library ( mod_store_mysql MODULE store/mysql/mysql_store.cpp )
287 target_link_libraries ( mod_store_mysql crypto logger common MySQL::Connector )
288 set_target_properties ( mod_store_mysql PROPERTIES PREFIX "" )
290 if ( CLANG_TIDY_EXE )
291 set_target_properties ( mod_store_mysql PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
293 if ( INCLUDE_WHAT_YOU_USE_EXE )
294 set_target_properties ( mod_store_mysql PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
296 endif ( BUILD_MOD_STORE_MYSQL )
298 if ( BUILD_MOD_STORE_POSTGRESQL )
299 find_package ( PostgreSQL REQUIRED )
300 include_directories ( ${PostgreSQL_INCLUDE_DIRS} )
301 add_library ( mod_store_postgresql MODULE store/postgresql/postgresql_store.cpp
302 store/postgresql/postgresql_store_admins.cpp
303 store/postgresql/postgresql_store_corporations.cpp
304 store/postgresql/postgresql_store_messages.cpp
305 store/postgresql/postgresql_store_services.cpp
306 store/postgresql/postgresql_store_tariffs.cpp
307 store/postgresql/postgresql_store_users.cpp
308 store/postgresql/postgresql_store_utils.cpp )
309 target_link_libraries ( mod_store_postgresql crypto logger common ${PostgreSQL_LIBRARIES} )
310 set_target_properties ( mod_store_postgresql PROPERTIES PREFIX "" )
311 if ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
312 set_target_properties ( mod_store_postgresql PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" )
313 endif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
315 if ( CLANG_TIDY_EXE )
316 set_target_properties ( mod_store_postgresql PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
318 if ( INCLUDE_WHAT_YOU_USE_EXE )
319 set_target_properties ( mod_store_postgresql PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
321 endif ( BUILD_MOD_STORE_POSTGRESQL )