@@ -58,6 +58,17 @@ include_directories(include)
58
58
# Main function for the examples.
59
59
#=======================================================================
60
60
61
+ add_library (test_common STATIC
62
+ tests/common.cpp
63
+ )
64
+ target_compile_features (test_common PUBLIC cxx_std_17 )
65
+ if (MSVC )
66
+ target_compile_options (test_common PRIVATE /bigobj )
67
+ target_compile_definitions (test_common PRIVATE _WIN32_WINNT=0x0601 )
68
+ endif ()
69
+
70
+ #=======================================================================
71
+
61
72
add_library (common STATIC
62
73
examples/start.cpp
63
74
examples/main.cpp
@@ -81,15 +92,6 @@ if (MSVC)
81
92
target_compile_definitions (cpp20_intro PRIVATE _WIN32_WINNT=0x0601 )
82
93
endif ()
83
94
84
- add_executable (cpp20_intro_awaitable_ops examples/cpp20_intro_awaitable_ops.cpp )
85
- target_link_libraries (cpp20_intro_awaitable_ops common )
86
- target_compile_features (cpp20_intro_awaitable_ops PUBLIC cxx_std_20 )
87
- add_test (cpp20_intro_awaitable_ops cpp20_intro_awaitable_ops )
88
- if (MSVC )
89
- target_compile_options (cpp20_intro_awaitable_ops PRIVATE /bigobj )
90
- target_compile_definitions (cpp20_intro_awaitable_ops PRIVATE _WIN32_WINNT=0x0601 )
91
- endif ()
92
-
93
95
add_executable (cpp17_intro examples/cpp17_intro.cpp )
94
96
target_compile_features (cpp17_intro PUBLIC cxx_std_17 )
95
97
add_test (cpp17_intro cpp17_intro )
@@ -156,10 +158,12 @@ if (Protobuf_FOUND)
156
158
endif ()
157
159
endif ()
158
160
159
- if (NOT MSVC )
160
161
add_executable (cpp20_subscriber examples/cpp20_subscriber.cpp )
161
162
target_compile_features (cpp20_subscriber PUBLIC cxx_std_20 )
162
163
target_link_libraries (cpp20_subscriber common )
164
+ if (MSVC )
165
+ target_compile_options (cpp20_subscriber PRIVATE /bigobj )
166
+ target_compile_definitions (cpp20_subscriber PRIVATE _WIN32_WINNT=0x0601 )
163
167
endif ()
164
168
165
169
add_executable (cpp20_intro_tls examples/cpp20_intro_tls.cpp )
@@ -205,6 +209,7 @@ endif()
205
209
206
210
add_executable (test_conn_exec tests/conn_exec.cpp )
207
211
target_compile_features (test_conn_exec PUBLIC cxx_std_20 )
212
+ target_link_libraries (test_conn_exec test_common )
208
213
add_test (test_conn_exec test_conn_exec )
209
214
if (MSVC )
210
215
target_compile_options (test_conn_exec PRIVATE /bigobj )
@@ -213,6 +218,7 @@ endif()
213
218
214
219
add_executable (test_conn_exec_retry tests/conn_exec_retry.cpp )
215
220
target_compile_features (test_conn_exec_retry PUBLIC cxx_std_20 )
221
+ target_link_libraries (test_conn_exec_retry test_common )
216
222
add_test (test_conn_exec_retry test_conn_exec_retry )
217
223
if (MSVC )
218
224
target_compile_options (test_conn_exec_retry PRIVATE /bigobj )
@@ -221,6 +227,7 @@ endif()
221
227
222
228
add_executable (test_conn_push tests/conn_push.cpp )
223
229
target_compile_features (test_conn_push PUBLIC cxx_std_20 )
230
+ target_link_libraries (test_conn_push test_common )
224
231
add_test (test_conn_push test_conn_push )
225
232
if (MSVC )
226
233
target_compile_options (test_conn_push PRIVATE /bigobj )
@@ -237,7 +244,7 @@ endif()
237
244
238
245
add_executable (test_conn_reconnect tests/conn_reconnect.cpp )
239
246
target_compile_features (test_conn_reconnect PUBLIC cxx_std_20 )
240
- target_link_libraries (test_conn_reconnect common )
247
+ target_link_libraries (test_conn_reconnect common test_common )
241
248
add_test (test_conn_reconnect test_conn_reconnect )
242
249
if (MSVC )
243
250
target_compile_options (test_conn_reconnect PRIVATE /bigobj )
@@ -271,16 +278,25 @@ endif()
271
278
272
279
add_executable (test_conn_exec_cancel tests/conn_exec_cancel.cpp )
273
280
target_compile_features (test_conn_exec_cancel PUBLIC cxx_std_20 )
274
- target_link_libraries (test_conn_exec_cancel common )
281
+ target_link_libraries (test_conn_exec_cancel common test_common )
275
282
add_test (test_conn_exec_cancel test_conn_exec_cancel )
276
283
if (MSVC )
277
284
target_compile_options (test_conn_exec_cancel PRIVATE /bigobj )
278
285
target_compile_definitions (test_conn_exec_cancel PRIVATE _WIN32_WINNT=0x0601 )
279
286
endif ()
280
287
288
+ add_executable (test_conn_exec_cancel2 tests/conn_exec_cancel2.cpp )
289
+ target_compile_features (test_conn_exec_cancel2 PUBLIC cxx_std_20 )
290
+ target_link_libraries (test_conn_exec_cancel2 common test_common )
291
+ add_test (test_conn_exec_cancel2 test_conn_exec_cancel2 )
292
+ if (MSVC )
293
+ target_compile_options (test_conn_exec_cancel2 PRIVATE /bigobj )
294
+ target_compile_definitions (test_conn_exec_cancel2 PRIVATE _WIN32_WINNT=0x0601 )
295
+ endif ()
296
+
281
297
add_executable (test_conn_exec_error tests/conn_exec_error.cpp )
282
298
target_compile_features (test_conn_exec_error PUBLIC cxx_std_17 )
283
- target_link_libraries (test_conn_exec_error common )
299
+ target_link_libraries (test_conn_exec_error common test_common )
284
300
add_test (test_conn_exec_error test_conn_exec_error )
285
301
if (MSVC )
286
302
target_compile_options (test_conn_exec_error PRIVATE /bigobj )
@@ -289,7 +305,7 @@ endif()
289
305
290
306
add_executable (test_conn_echo_stress tests/conn_echo_stress.cpp )
291
307
target_compile_features (test_conn_echo_stress PUBLIC cxx_std_20 )
292
- target_link_libraries (test_conn_echo_stress common )
308
+ target_link_libraries (test_conn_echo_stress common test_common )
293
309
add_test (test_conn_echo_stress test_conn_echo_stress )
294
310
if (MSVC )
295
311
target_compile_options (test_conn_echo_stress PRIVATE /bigobj )
@@ -304,22 +320,27 @@ if (MSVC)
304
320
target_compile_definitions (test_request PRIVATE _WIN32_WINNT=0x0601 )
305
321
endif ()
306
322
307
- if (NOT MSVC )
308
323
add_executable (test_issue_50 tests/issue_50.cpp )
309
324
target_compile_features (test_issue_50 PUBLIC cxx_std_20 )
310
325
target_link_libraries (test_issue_50 common )
311
326
add_test (test_issue_50 test_issue_50 )
327
+ if (MSVC )
328
+ target_compile_options (test_issue_50 PRIVATE /bigobj )
329
+ target_compile_definitions (test_issue_50 PRIVATE _WIN32_WINNT=0x0601 )
312
330
endif ()
313
331
314
- if (NOT MSVC )
315
332
add_executable (test_conn_check_health tests/conn_check_health.cpp )
316
333
target_compile_features (test_conn_check_health PUBLIC cxx_std_17 )
317
334
target_link_libraries (test_conn_check_health common )
318
335
add_test (test_conn_check_health test_conn_check_health )
336
+ if (MSVC )
337
+ target_compile_options (test_conn_check_health PRIVATE /bigobj )
338
+ target_compile_definitions (test_conn_check_health PRIVATE _WIN32_WINNT=0x0601 )
319
339
endif ()
320
340
321
341
add_executable (test_run tests/run.cpp )
322
342
target_compile_features (test_run PUBLIC cxx_std_17 )
343
+ target_link_libraries (test_run test_common )
323
344
add_test (test_run test_run )
324
345
if (MSVC )
325
346
target_compile_options (test_run PRIVATE /bigobj )
0 commit comments