]> git.stg.codes - stg.git/blob - projects/stargazer/plugins/CMakeLists.txt
Check if we can use C++17 with XMLRPC-C.
[stg.git] / projects / stargazer / plugins / CMakeLists.txt
1 if ( BUILD_MOD_AO )
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 "" )
5
6     if ( CLANG_TIDY_EXE )
7         set_target_properties ( mod_auth_ao PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
8     endif ()
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}" )
11     endif ()
12 endif ( BUILD_MOD_AO )
13
14 if ( BUILD_MOD_IA )
15     add_library ( mod_auth_ia MODULE authorization/inetaccess/inetaccess.cpp )
16     target_link_libraries ( mod_auth_ia scriptexecuter crypto logger common )
17     set_target_properties ( mod_auth_ia PROPERTIES PREFIX "" )
18     if ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
19         set_target_properties ( mod_auth_ia PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" )
20     endif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
21
22     if ( CLANG_TIDY_EXE )
23         set_target_properties ( mod_auth_ia PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
24     endif ()
25     if ( INCLUDE_WHAT_YOU_USE_EXE )
26         set_target_properties ( mod_auth_ia PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
27     endif ()
28 endif ( BUILD_MOD_IA )
29
30 if ( BUILD_MOD_CAP_NF )
31     add_library ( mod_cap_nf MODULE capture/cap_nf/cap_nf.cpp )
32     target_link_libraries ( mod_cap_nf logger common )
33     set_target_properties ( mod_cap_nf PROPERTIES PREFIX "" )
34
35     if ( CLANG_TIDY_EXE )
36         set_target_properties ( mod_cap_nf PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
37     endif ()
38     if ( INCLUDE_WHAT_YOU_USE_EXE )
39         set_target_properties ( mod_cap_nf PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
40     endif ()
41 endif ( BUILD_MOD_CAP_NF )
42
43 if ( BUILD_MOD_CAP_DIVERT )
44     add_library ( mod_cap_divert MODULE capture/divert_freebsd/divert_cap.cpp )
45     target_link_libraries ( mod_cap_divert logger common )
46     set_target_properties ( mod_cap_divert PROPERTIES PREFIX "" )
47
48     if ( CLANG_TIDY_EXE )
49         set_target_properties ( mod_cap_divert PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
50     endif ()
51     if ( INCLUDE_WHAT_YOU_USE_EXE )
52         set_target_properties ( mod_cap_divert PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
53     endif ()
54 endif ( BUILD_MOD_CAP_DIVERT )
55
56 if ( BUILD_MOD_CAP_ETHER_FREEBSD )
57     add_library ( mod_cap_bpf MODULE capture/ether_freebsd/ether_cap.cpp )
58     target_link_libraries ( mod_cap_bpf logger common )
59     set_target_properties ( mod_cap_bpf PROPERTIES PREFIX "" )
60
61     if ( CLANG_TIDY_EXE )
62         set_target_properties ( mod_cap_bpf PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
63     endif ()
64     if ( INCLUDE_WHAT_YOU_USE_EXE )
65         set_target_properties ( mod_cap_bpf PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
66     endif ()
67 endif ( BUILD_MOD_CAP_ETHER_FREEBSD )
68
69 if ( BUILD_MOD_CAP_ETHER_LINUX )
70     add_library ( mod_cap_ether MODULE capture/ether_linux/ether_cap.cpp )
71     target_link_libraries ( mod_cap_ether logger common )
72     set_target_properties ( mod_cap_ether PROPERTIES PREFIX "" )
73
74     if ( CLANG_TIDY_EXE )
75         set_target_properties ( mod_cap_ether PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
76     endif ()
77     if ( INCLUDE_WHAT_YOU_USE_EXE )
78         set_target_properties ( mod_cap_ether PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
79     endif ()
80 endif ( BUILD_MOD_CAP_ETHER_LINUX )
81
82 if ( BUILD_MOD_CAP_PCAP )
83     find_package ( PCap REQUIRED )
84     add_library ( mod_cap_pcap MODULE capture/pcap/pcap_cap.cpp )
85     target_link_libraries ( mod_cap_pcap logger common PCap::PCap )
86     set_target_properties ( mod_cap_pcap PROPERTIES PREFIX "" )
87
88     if ( CLANG_TIDY_EXE )
89         set_target_properties ( mod_cap_pcap PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
90     endif ()
91     if ( INCLUDE_WHAT_YOU_USE_EXE )
92         set_target_properties ( mod_cap_pcap PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
93     endif ()
94 endif ( BUILD_MOD_CAP_PCAP )
95
96 if ( BUILD_MOD_CAP_NFQUEUE )
97     find_package ( NFQueue REQUIRED )
98     find_package ( NFNetLink REQUIRED )
99     find_package ( MNL REQUIRED )
100     add_library ( mod_cap_nfqueue MODULE capture/nfqueue/nfqueue.cpp )
101     target_link_libraries ( mod_cap_nfqueue logger common NF::Queue NF::NetLink MNL::MNL )
102     set_target_properties ( mod_cap_nfqueue PROPERTIES PREFIX "" )
103
104     if ( CLANG_TIDY_EXE )
105         set_target_properties ( mod_cap_nfqueue PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
106     endif ()
107     if ( INCLUDE_WHAT_YOU_USE_EXE )
108         set_target_properties ( mod_cap_nfqueue PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
109     endif ()
110 endif ( BUILD_MOD_CAP_NFQUEUE )
111
112 if ( BUILD_MOD_SGCONFIG )
113     find_package ( EXPAT REQUIRED )
114     add_library ( mod_conf_sg MODULE configuration/sgconfig/stgconfig.cpp
115                                      configuration/sgconfig/conn.cpp
116                                      configuration/sgconfig/configproto.cpp
117                                      configuration/sgconfig/parser.cpp
118                                      configuration/sgconfig/parser_tariffs.cpp
119                                      configuration/sgconfig/parser_admins.cpp
120                                      configuration/sgconfig/parser_users.cpp
121                                      configuration/sgconfig/parser_services.cpp
122                                      configuration/sgconfig/parser_message.cpp
123                                      configuration/sgconfig/parser_auth_by.cpp
124                                      configuration/sgconfig/parser_user_info.cpp
125                                      configuration/sgconfig/parser_server_info.cpp )
126     target_link_libraries ( mod_conf_sg scriptexecuter crypto logger common EXPAT::EXPAT )
127     set_target_properties ( mod_conf_sg PROPERTIES PREFIX "" )
128     if ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
129         set_target_properties ( mod_conf_sg PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" )
130     endif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
131
132     if ( CLANG_TIDY_EXE )
133         set_target_properties ( mod_conf_sg PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
134     endif ()
135     if ( INCLUDE_WHAT_YOU_USE_EXE )
136         set_target_properties ( mod_conf_sg PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
137     endif ()
138 endif ( BUILD_MOD_SGCONFIG )
139
140 if ( BUILD_MOD_RPCCONFIG )
141     find_package ( XMLRPC 1.58.0 REQUIRED c++2 abyss-server )
142     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 )
143     if ( NOT XMLRPC_C_NO_AUTO_PTR )
144         message ( WARNING ${TRY_COMPILE_OUTPUT} )
145         message ( FATAL_ERROR "Your version of XMLRPC-C library can not be used with C++17. Try upgrading to at least 1.58.0." )
146     endif ()
147     include_directories ( ${XMLRPC_INCLUDE_DIRS} )
148     add_library ( mod_conf_rpc MODULE configuration/rpcconfig/rpcconfig.cpp
149                                       configuration/rpcconfig/user_helper.cpp
150                                       configuration/rpcconfig/tariff_helper.cpp
151                                       configuration/rpcconfig/info_methods.cpp
152                                       configuration/rpcconfig/users_methods.cpp
153                                       configuration/rpcconfig/tariffs_methods.cpp
154                                       configuration/rpcconfig/admins_methods.cpp
155                                       configuration/rpcconfig/messages_methods.cpp )
156     target_link_libraries ( mod_conf_rpc scriptexecuter logger common ${XMLRPC_LIBRARIES} )
157     set_target_properties ( mod_conf_rpc PROPERTIES PREFIX "" )
158
159     if ( CLANG_TIDY_EXE )
160         set_target_properties ( mod_conf_rpc PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
161     endif ()
162     if ( INCLUDE_WHAT_YOU_USE_EXE )
163         set_target_properties ( mod_conf_rpc PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
164     endif ()
165 endif ( BUILD_MOD_RPCCONFIG )
166
167 if ( BUILD_MOD_PING )
168     add_library ( mod_ping MODULE other/ping/ping.cpp )
169     target_link_libraries ( mod_ping scriptexecuter logger pinger common )
170     set_target_properties ( mod_ping PROPERTIES PREFIX "" )
171
172     if ( CLANG_TIDY_EXE )
173         set_target_properties ( mod_ping PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
174     endif ()
175     if ( INCLUDE_WHAT_YOU_USE_EXE )
176         set_target_properties ( mod_ping PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
177     endif ()
178 endif ( BUILD_MOD_PING )
179
180 if ( BUILD_MOD_RSCRYPT )
181     add_library ( mod_remote_script MODULE other/rscript/rscript.cpp other/rscript/nrmap_parser.cpp )
182     target_link_libraries ( mod_remote_script crypto scriptexecuter logger common )
183     set_target_properties ( mod_remote_script PROPERTIES PREFIX "" )
184     if ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
185         set_target_properties ( mod_remote_script PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" )
186     endif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
187
188     if ( CLANG_TIDY_EXE )
189         set_target_properties ( mod_remote_script PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
190     endif ()
191     if ( INCLUDE_WHAT_YOU_USE_EXE )
192         set_target_properties ( mod_remote_script PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
193     endif ()
194 endif ( BUILD_MOD_RSCRYPT )
195
196 if ( BUILD_MOD_SMUX )
197     add_library ( mod_smux MODULE other/smux/smux.cpp
198                                   other/smux/sensors.cpp
199                                   other/smux/tables.cpp
200                                   other/smux/handlers.cpp
201                                   other/smux/utils.cpp
202                                   other/smux/types.cpp )
203     target_link_libraries ( mod_smux scriptexecuter logger smux common )
204     set_target_properties ( mod_smux PROPERTIES PREFIX "" )
205
206     if ( CLANG_TIDY_EXE )
207         set_target_properties ( mod_smux PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
208     endif ()
209     if ( INCLUDE_WHAT_YOU_USE_EXE )
210         set_target_properties ( mod_smux PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
211     endif ()
212 endif ( BUILD_MOD_SMUX )
213
214 if ( BUILD_MOD_STORE_FILES )
215     add_library ( mod_store_files MODULE store/files/file_store.cpp )
216     target_link_libraries ( mod_store_files crypto conffiles logger common )
217     set_target_properties ( mod_store_files PROPERTIES PREFIX "" )
218
219     if ( CLANG_TIDY_EXE )
220         set_target_properties ( mod_store_files PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
221     endif ()
222     if ( INCLUDE_WHAT_YOU_USE_EXE )
223         set_target_properties ( mod_store_files PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
224     endif ()
225 endif ( BUILD_MOD_STORE_FILES )
226
227 if ( BUILD_MOD_STORE_FIREBIRD )
228     find_package ( FBClient REQUIRED )
229     add_library ( mod_store_firebird MODULE store/firebird/firebird_store.cpp
230                                             store/firebird/firebird_store_admins.cpp
231                                             store/firebird/firebird_store_corporations.cpp
232                                             store/firebird/firebird_store_messages.cpp
233                                             store/firebird/firebird_store_services.cpp
234                                             store/firebird/firebird_store_tariffs.cpp
235                                             store/firebird/firebird_store_users.cpp
236                                             store/firebird/firebird_store_utils.cpp )
237     target_link_libraries ( mod_store_firebird crypto common logger ibpp FBClient::FBClient )
238     set_target_properties ( mod_store_firebird PROPERTIES PREFIX "" )
239
240     if ( CLANG_TIDY_EXE )
241         set_target_properties ( mod_store_firebird PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
242     endif ()
243     if ( INCLUDE_WHAT_YOU_USE_EXE )
244         set_target_properties ( mod_store_firebird PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
245     endif ()
246 endif ( BUILD_MOD_STORE_FIREBIRD )
247
248 if ( BUILD_MOD_STORE_MYSQL )
249     find_package ( MySQLConnector REQUIRED )
250     add_library ( mod_store_mysql MODULE store/mysql/mysql_store.cpp )
251     target_link_libraries ( mod_store_mysql crypto logger common MySQL::Connector )
252     set_target_properties ( mod_store_mysql PROPERTIES PREFIX "" )
253
254     if ( CLANG_TIDY_EXE )
255         set_target_properties ( mod_store_mysql PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
256     endif ()
257     if ( INCLUDE_WHAT_YOU_USE_EXE )
258         set_target_properties ( mod_store_mysql PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
259     endif ()
260 endif ( BUILD_MOD_STORE_MYSQL )
261
262 if ( BUILD_MOD_STORE_POSTGRESQL )
263     find_package ( PostgreSQL REQUIRED )
264     include_directories ( ${PostgreSQL_INCLUDE_DIRS} )
265     add_library ( mod_store_postgresql MODULE store/postgresql/postgresql_store.cpp
266                                               store/postgresql/postgresql_store_admins.cpp
267                                               store/postgresql/postgresql_store_corporations.cpp
268                                               store/postgresql/postgresql_store_messages.cpp
269                                               store/postgresql/postgresql_store_services.cpp
270                                               store/postgresql/postgresql_store_tariffs.cpp
271                                               store/postgresql/postgresql_store_users.cpp
272                                               store/postgresql/postgresql_store_utils.cpp )
273                                       target_link_libraries ( mod_store_postgresql crypto logger common ${PostgreSQL_LIBRARIES} )
274     set_target_properties ( mod_store_postgresql PROPERTIES PREFIX "" )
275
276     if ( CLANG_TIDY_EXE )
277         set_target_properties ( mod_store_postgresql PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
278     endif ()
279     if ( INCLUDE_WHAT_YOU_USE_EXE )
280         set_target_properties ( mod_store_postgresql PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
281     endif ()
282 endif ( BUILD_MOD_STORE_POSTGRESQL )