forked from zeromq/libzmq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
1916 lines (1696 loc) · 62.6 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# CMake build script for ZeroMQ
project(ZeroMQ)
if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
cmake_minimum_required(VERSION 3.0.2)
else()
cmake_minimum_required(VERSION 2.8.12)
endif()
include(CheckIncludeFiles)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckLibraryExists)
include(CheckCSourceCompiles)
include(CheckCSourceRuns)
include(CMakeDependentOption)
include(CheckCXXSymbolExists)
include(CheckStructHasMember)
include(CheckTypeSize)
include(FindThreads)
include(GNUInstallDirs)
include(CheckTypeSize)
include(CMakePackageConfigHelpers)
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}")
set(ZMQ_CMAKE_MODULES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/Modules)
list(APPEND CMAKE_MODULE_PATH ${ZMQ_CMAKE_MODULES_DIR})
include(TestZMQVersion)
include(ZMQSourceRunChecks)
include(ZMQSupportMacros)
find_package(PkgConfig)
# Set lists to empty beforehand as to not accidentally take values from parent
set(sources)
set(cxx-sources)
set(html-docs)
set(target_outputs)
option(ENABLE_ASAN "Build with address sanitizer" OFF)
if(ENABLE_ASAN)
message(STATUS "Instrumenting with Address Sanitizer")
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope")
endif()
# NOTE: Running libzmq under TSAN doesn't make much sense -- synchronization in libzmq is to some extent
# handled by the code "knowing" what threads are allowed to do, rather than by enforcing those
# restrictions, so TSAN generates a lot of (presumably) false positives from libzmq.
# The settings below are intended to enable libzmq to be built with minimal support for TSAN
# such that it can be used along with other code that is also built with TSAN.
option(ENABLE_TSAN "Build with thread sanitizer" OFF)
if(ENABLE_TSAN)
message(STATUS "Instrumenting with Thread Sanitizer")
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
set(TSAN_FLAGS "-fno-omit-frame-pointer -fsanitize=thread")
set(TSAN_CCFLAGS "${TSAN_CCFLAGS} -mllvm -tsan-instrument-memory-accesses=0")
set(TSAN_CCFLAGS "${TSAN_CCFLAGS} -mllvm -tsan-instrument-atomics=0")
set(TSAN_CCFLAGS "${TSAN_CCFLAGS} -mllvm -tsan-instrument-func-entry-exit=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TSAN_FLAGS} ${TSAN_CCFLAGS} -fPIE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TSAN_FLAGS} ${TSAN_CCFLAGS} -fPIE")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${TSAN_FLAGS} -pie -Qunused-arguments")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${TSAN_FLAGS} -pie -Qunused-arguments")
endif()
option(ENABLE_UBSAN "Build with undefined behavior sanitizer" OFF)
if(ENABLE_UBSAN)
message(STATUS "Instrumenting with Undefined Behavior Sanitizer")
set(CMAKE_BUILD_TYPE "Debug")
set(UBSAN_FLAGS "${UBSAN_FLAGS} -fno-omit-frame-pointer")
set(UBSAN_FLAGS "${UBSAN_FLAGS} -fsanitize=undefined")
set(UBSAN_FLAGS "${UBSAN_FLAGS} -fsanitize=implicit-conversion")
set(UBSAN_FLAGS "${UBSAN_FLAGS} -fsanitize=implicit-integer-truncation")
set(UBSAN_FLAGS "${UBSAN_FLAGS} -fsanitize=integer")
set(UBSAN_FLAGS "${UBSAN_FLAGS} -fsanitize=nullability")
set(UBSAN_FLAGS "${UBSAN_FLAGS} -fsanitize=vptr")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${UBSAN_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${UBSAN_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${UBSAN_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${UBSAN_FLAGS}")
endif()
option(ENABLE_INTRINSICS "Build using compiler intrinsics for atomic ops" OFF)
if(ENABLE_INTRINSICS)
message(STATUS "Using compiler intrinsics for atomic ops")
add_definitions(-DZMQ_HAVE_ATOMIC_INTRINSICS)
endif()
set(ZMQ_OUTPUT_BASENAME
"zmq"
CACHE STRING "Output zmq library base name")
if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
# Find more information: https://cmake.org/Wiki/CMake_RPATH_handling
# Apply CMP0042: MACOSX_RPATH is enabled by default
cmake_policy(SET CMP0042 NEW)
# Add an install rpath if it is not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
endif()
# Add linker search paths pointing to external dependencies
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
if (NOT MSVC)
if(NOT CMAKE_CXX_FLAGS MATCHES "-std=" AND NOT CXX_STANDARD AND NOT CMAKE_CXX_STANDARD)
# use C++11 by default if supported
check_cxx_compiler_flag("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
endif()
if(NOT CMAKE_C_FLAGS MATCHES "-std=" AND NOT C_STANDARD AND NOT CMAKE_C_STANDARD)
check_c_compiler_flag("-std=c11" COMPILER_SUPPORTS_C11)
if(COMPILER_SUPPORTS_C11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_DEFAULT_SOURCE -std=c11")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
endif()
endif()
# clang 6 has a warning that does not make sense on multi-platform code
check_cxx_compiler_flag("-Wno-tautological-constant-compare" CXX_HAS_TAUT_WARNING)
if(CXX_HAS_TAUT_WARNING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-tautological-constant-compare")
endif()
check_c_compiler_flag("-Wno-tautological-constant-compare" CC_HAS_TAUT_WARNING)
if(CC_HAS_TAUT_WARNING)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-tautological-constant-compare")
endif()
endif()
# Will be used to add flags to pkg-config useful when apps want to statically link
set(pkg_config_libs_private "")
set(pkg_config_names_private "")
set(pkg_config_defines "")
option(WITH_OPENPGM "Build with support for OpenPGM" OFF)
option(WITH_NORM "Build with support for NORM" OFF)
option(WITH_VMCI "Build with support for VMware VMCI socket" OFF)
if(APPLE)
option(ZMQ_BUILD_FRAMEWORK "Build as OS X framework" OFF)
endif()
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
option(ENABLE_DRAFTS "Build and install draft classes and methods" ON)
else()
option(ENABLE_DRAFTS "Build and install draft classes and methods" OFF)
endif()
# Enable WebSocket transport and RadixTree
if(ENABLE_DRAFTS)
message(STATUS "Building draft classes and methods")
option(ENABLE_WS "Enable WebSocket transport" ON)
option(ENABLE_RADIX_TREE "Use radix tree implementation to manage subscriptions" ON)
set(pkg_config_defines "-DZMQ_BUILD_DRAFT_API=1")
else()
message(STATUS "Not building draft classes and methods")
option(ENABLE_WS "Enable WebSocket transport" OFF)
option(ENABLE_RADIX_TREE "Use radix tree implementation to manage subscriptions" OFF)
endif()
if(ENABLE_RADIX_TREE)
message(STATUS "Using radix tree implementation to manage subscriptions")
set(ZMQ_USE_RADIX_TREE 1)
endif()
if(ENABLE_WS)
list(
APPEND
sources
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_address.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_connecter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_decoder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_encoder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_engine.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_listener.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_address.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_connecter.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_decoder.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_encoder.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_engine.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_listener.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_protocol.hpp)
set(ZMQ_HAVE_WS 1)
message(STATUS "Enable WebSocket transport")
option(WITH_TLS "Use TLS for WSS support" ON)
option(WITH_NSS "Use NSS instead of builtin sha1" OFF)
if(WITH_TLS)
find_package("GnuTLS" 3.6.7)
if(GNUTLS_FOUND)
set(pkg_config_names_private "${pkg_config_names_private} gnutls")
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/src/wss_address.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/wss_address.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/wss_engine.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/wss_engine.cpp)
message(STATUS "Enable WSS transport")
set(ZMQ_USE_GNUTLS 1)
set(ZMQ_HAVE_WSS 1)
else()
message(WARNING "No WSS support, you may want to install GnuTLS and run cmake again")
endif()
endif()
endif()
if(NOT ZMQ_USE_GNUTLS)
if(WITH_NSS)
pkg_check_modules(NSS3 "nss")
if(NSS3_FOUND)
set(pkg_config_names_private "${pkg_config_names_private} nss")
message(STATUS "Using NSS")
set(ZMQ_USE_NSS 1)
else()
find_package("NSS3")
if(NSS3_FOUND)
set(pkg_config_libs_private "${pkg_config_libs_private} -lnss3")
message(STATUS "Using NSS")
set(ZMQ_USE_NSS 1)
else()
message(WARNING "No nss installed, if you don't want builtin SHA1, install NSS or GnuTLS")
endif()
endif()
endif()
if(ENABLE_WS AND NOT ZMQ_USE_NSS)
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/external/sha1/sha1.c
${CMAKE_CURRENT_SOURCE_DIR}/external/sha1/sha1.h)
message(STATUS "Using builtin sha1")
set(ZMQ_USE_BUILTIN_SHA1 1)
endif()
endif()
if(NOT MSVC)
option(WITH_LIBBSD "Use libbsd instead of builtin strlcpy" ON)
if(WITH_LIBBSD)
pkg_check_modules(LIBBSD "libbsd")
if(LIBBSD_FOUND)
message(STATUS "Using libbsd")
set(pkg_config_names_private "${pkg_config_names_private} libbsd")
set(ZMQ_HAVE_LIBBSD 1)
endif()
endif()
check_cxx_symbol_exists(strlcpy string.h ZMQ_HAVE_STRLCPY)
endif()
# Select curve encryption library, defaults to disabled To use libsodium instead, use --with-libsodium(must be
# installed) To disable curve, use --disable-curve
option(WITH_LIBSODIUM "Use libsodium (required with ENABLE_CURVE)" OFF)
option(WITH_LIBSODIUM_STATIC "Use static libsodium library" OFF)
option(ENABLE_LIBSODIUM_RANDOMBYTES_CLOSE "Automatically close libsodium randombytes. Not threadsafe without getrandom()" ON)
option(ENABLE_CURVE "Enable CURVE security" OFF)
if(ENABLE_CURVE)
# libsodium is currently the only CURVE provider
if(WITH_LIBSODIUM)
find_package("sodium")
if(SODIUM_FOUND)
message(STATUS "Using libsodium for CURVE security")
include_directories(${SODIUM_INCLUDE_DIRS})
link_directories(${SODIUM_LIBRARY_DIRS})
if(WITH_LIBSODIUM_STATIC)
add_compile_definitions(SODIUM_STATIC)
endif()
set(ZMQ_USE_LIBSODIUM 1)
set(ZMQ_HAVE_CURVE 1)
if (ENABLE_LIBSODIUM_RANDOMBYTES_CLOSE)
set(ZMQ_LIBSODIUM_RANDOMBYTES_CLOSE 1)
endif()
else()
message(
FATAL_ERROR
"libsodium requested but not found, you may want to install libsodium and run cmake again"
)
endif()
else() # WITH_LIBSODIUM
message(
FATAL_ERROR
"ENABLE_CURVE set, but not WITH_LIBSODIUM. No CURVE provider found."
)
endif()
else() # ENABLE_CURVE
message(STATUS "CURVE security is disabled")
endif()
option(WITH_GSSAPI_KRB5 "Use libgssapi_krb5" OFF)
if(WITH_GSSAPI_KRB5)
find_package("gssapi_krb5" REQUIRED)
message(STATUS "Using GSSAPI_KRB5")
include_directories(${GSSAPI_KRB5_INCLUDE_DIRS})
link_directories(${GSSAPI_KRB5_LIBRARY_DIRS})
set(HAVE_LIBGSSAPI_KRB5 1)
endif()
set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
option(WITH_MILITANT "Enable militant assertions" OFF)
if(WITH_MILITANT)
add_definitions(-DZMQ_ACT_MILITANT)
endif()
set(API_POLLER
""
CACHE STRING "Choose polling system for zmq_poll(er)_*. valid values are
poll or select [default=poll unless POLLER=select]")
set(POLLER
""
CACHE STRING "Choose polling system for I/O threads. valid values are
kqueue, epoll, devpoll, pollset, poll or select [default=autodetect]")
if(WIN32)
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND CMAKE_SYSTEM_VERSION MATCHES "^10.0")
set(ZMQ_HAVE_WINDOWS_UWP ON)
set(ZMQ_HAVE_IPC OFF)
# to remove compile warninging "D9002 ignoring unknown option"
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
set(CMAKE_CXX_FLAGS_DEBUG
${CMAKE_CXX_FLAGS_DEBUG}
CACHE STRING "" FORCE)
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
${CMAKE_CXX_FLAGS_RELWITHDEBINFO}
CACHE STRING "" FORCE)
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
endif()
# from https://stackoverflow.com/a/40217291/2019765
macro(get_WIN32_WINNT version)
if(CMAKE_SYSTEM_VERSION)
set(ver ${CMAKE_SYSTEM_VERSION})
string(REGEX MATCH "^([0-9]+).([0-9])" ver ${ver})
string(REGEX MATCH "^([0-9]+)" verMajor ${ver})
# Check for Windows 10, b/c we'll need to convert to hex 'A'.
if("${verMajor}" MATCHES "10")
set(verMajor "A")
string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver ${ver})
endif("${verMajor}" MATCHES "10")
# Remove all remaining '.' characters.
string(REPLACE "." "" ver ${ver})
# Prepend each digit with a zero.
string(REGEX REPLACE "([0-9A-Z])" "0\\1" ver ${ver})
set(${version} "0x${ver}")
endif(CMAKE_SYSTEM_VERSION)
endmacro(get_WIN32_WINNT)
get_win32_winnt(ZMQ_WIN32_WINNT_DEFAULT)
message(STATUS "Detected _WIN32_WINNT from CMAKE_SYSTEM_VERSION: ${ZMQ_WIN32_WINNT_DEFAULT}")
# TODO limit _WIN32_WINNT to the actual Windows SDK version, which might be different from the default version
# installed with Visual Studio
if(MSVC_VERSION STREQUAL "1500" AND CMAKE_SYSTEM_VERSION VERSION_GREATER "6.0")
set(ZMQ_WIN32_WINNT_LIMIT "0x0600")
elseif(MSVC_VERSION STREQUAL "1600" AND CMAKE_SYSTEM_VERSION VERSION_GREATER "6.1")
set(ZMQ_WIN32_WINNT_LIMIT "0x0601")
elseif(MSVC_VERSION STREQUAL "1700" AND CMAKE_SYSTEM_VERSION VERSION_GREATER "6.1")
set(ZMQ_WIN32_WINNT_LIMIT "0x0601")
elseif(MSVC_VERSION STREQUAL "1800" AND CMAKE_SYSTEM_VERSION VERSION_GREATER "6.2")
set(ZMQ_WIN32_WINNT_LIMIT "0x0602")
endif()
if(ZMQ_WIN32_WINNT_LIMIT)
message(
STATUS
"Mismatch of Visual Studio Version (${MSVC_VERSION}) and CMAKE_SYSTEM_VERSION (${CMAKE_SYSTEM_VERSION}), limiting _WIN32_WINNT to ${ZMQ_WIN32_WINNT_LIMIT}, you may override this by setting ZMQ_WIN32_WINNT"
)
set(ZMQ_WIN32_WINNT_DEFAULT "${ZMQ_WIN32_WINNT_LIMIT}")
endif()
set(ZMQ_WIN32_WINNT
"${ZMQ_WIN32_WINNT_DEFAULT}"
CACHE STRING "Value to set _WIN32_WINNT to for building [default=autodetect from build environment]")
# On Windows Vista or greater, with MSVC 2013 or greater, default to epoll (which is required on Win 10 for ipc
# support)
if(ZMQ_WIN32_WINNT GREATER "0x05FF"
AND MSVC_VERSION GREATER 1799
AND POLLER STREQUAL ""
AND NOT ZMQ_HAVE_WINDOWS_UWP)
set(POLLER "epoll")
endif()
add_definitions(-D_WIN32_WINNT=${ZMQ_WIN32_WINNT})
endif(WIN32)
if(NOT MSVC)
if(POLLER STREQUAL "")
check_cxx_symbol_exists(kqueue "sys/types.h;sys/event.h;sys/time.h" HAVE_KQUEUE)
if(HAVE_KQUEUE)
set(POLLER "kqueue")
endif()
endif()
if(POLLER STREQUAL "")
check_cxx_symbol_exists(epoll_create sys/epoll.h HAVE_EPOLL)
if(HAVE_EPOLL)
set(POLLER "epoll")
check_cxx_symbol_exists(epoll_create1 sys/epoll.h HAVE_EPOLL_CLOEXEC)
if(HAVE_EPOLL_CLOEXEC)
set(ZMQ_IOTHREAD_POLLER_USE_EPOLL_CLOEXEC 1)
endif()
endif()
endif()
if(POLLER STREQUAL "")
check_include_files("sys/devpoll.h" HAVE_DEVPOLL)
if(HAVE_DEVPOLL)
set(POLLER "devpoll")
endif()
endif()
if(POLLER STREQUAL "")
check_cxx_symbol_exists(pollset_create sys/pollset.h HAVE_POLLSET)
if(HAVE_POLLSET)
set(POLLER "pollset")
endif()
endif()
if(POLLER STREQUAL "")
check_cxx_symbol_exists(poll poll.h HAVE_POLL)
if(HAVE_POLL)
set(POLLER "poll")
endif()
endif()
endif()
if(POLLER STREQUAL "")
if(WIN32)
set(HAVE_SELECT 1)
else()
check_cxx_symbol_exists(select sys/select.h HAVE_SELECT)
endif()
if(HAVE_SELECT)
set(POLLER "select")
else()
message(FATAL_ERROR "Could not autodetect polling method")
endif()
endif()
if(POLLER STREQUAL "kqueue"
OR POLLER STREQUAL "epoll"
OR POLLER STREQUAL "devpoll"
OR POLLER STREQUAL "pollset"
OR POLLER STREQUAL "poll"
OR POLLER STREQUAL "select")
message(STATUS "Using polling method in I/O threads: ${POLLER}")
string(TOUPPER ${POLLER} UPPER_POLLER)
set(ZMQ_IOTHREAD_POLLER_USE_${UPPER_POLLER} 1)
else()
message(FATAL_ERROR "Invalid polling method")
endif()
if(POLLER STREQUAL "epoll" AND WIN32)
message(STATUS "Including wepoll")
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/external/wepoll/wepoll.c
${CMAKE_CURRENT_SOURCE_DIR}/external/wepoll/wepoll.h)
endif()
if(API_POLLER STREQUAL "")
if(POLLER STREQUAL "select")
set(API_POLLER "select")
else()
set(API_POLLER "poll")
endif()
endif()
message(STATUS "Using polling method in zmq_poll(er)_* API: ${API_POLLER}")
string(TOUPPER ${API_POLLER} UPPER_API_POLLER)
set(ZMQ_POLL_BASED_ON_${UPPER_API_POLLER} 1)
check_cxx_symbol_exists(pselect sys/select.h HAVE_PSELECT)
if (NOT WIN32 AND HAVE_PSELECT)
set(ZMQ_HAVE_PPOLL 1)
endif()
# special alignment settings
execute_process(
COMMAND getconf LEVEL1_DCACHE_LINESIZE
OUTPUT_VARIABLE CACHELINE_SIZE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(CACHELINE_SIZE STREQUAL ""
OR CACHELINE_SIZE EQUAL 0
OR CACHELINE_SIZE EQUAL -1
OR CACHELINE_SIZE STREQUAL "undefined")
set(ZMQ_CACHELINE_SIZE 64)
else()
set(ZMQ_CACHELINE_SIZE ${CACHELINE_SIZE})
endif()
message(STATUS "Using ${ZMQ_CACHELINE_SIZE} bytes alignment for lock-free data structures")
check_cxx_symbol_exists(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
if(NOT CYGWIN)
# TODO cannot we simply do 'if(WIN32) set(ZMQ_HAVE_WINDOWS ON)' or similar?
check_include_files(windows.h ZMQ_HAVE_WINDOWS)
endif()
if(NOT WIN32)
set(ZMQ_HAVE_IPC 1)
set(ZMQ_HAVE_STRUCT_SOCKADDR_UN 1)
else()
check_include_files("winsock2.h;afunix.h" ZMQ_HAVE_IPC)
if(ZMQ_HAVE_IPC)
check_struct_has_member("struct sockaddr_un" sun_path "winsock2.h;afunix.h" ZMQ_HAVE_STRUCT_SOCKADDR_UN)
endif()
endif()
# ##################### BEGIN condition_variable_t selection
if(NOT ZMQ_CV_IMPL)
# prefer C++11 STL std::condition_variable implementation, if available
check_include_files(condition_variable ZMQ_HAVE_STL_CONDITION_VARIABLE LANGUAGE CXX)
if(ZMQ_HAVE_STL_CONDITION_VARIABLE)
set(ZMQ_CV_IMPL_DEFAULT "stl11")
else()
if(WIN32 AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS "6.0")
# Win32API CONDITION_VARIABLE is supported from Windows Vista only
set(ZMQ_CV_IMPL_DEFAULT "win32api")
elseif(CMAKE_USE_PTHREADS_INIT)
set(ZMQ_CV_IMPL_DEFAULT "pthreads")
else()
set(ZMQ_CV_IMPL_DEFAULT "none")
endif()
endif()
# TODO a vxworks implementation also exists, but vxworks is not currently supported with cmake at all
set(ZMQ_CV_IMPL
"${ZMQ_CV_IMPL_DEFAULT}"
CACHE STRING "Choose condition_variable_t implementation. Valid values are
stl11, win32api, pthreads, none [default=autodetect]")
endif()
message(STATUS "Using condition_variable_t implementation: ${ZMQ_CV_IMPL}")
if(ZMQ_CV_IMPL STREQUAL "stl11")
set(ZMQ_USE_CV_IMPL_STL11 1)
elseif(ZMQ_CV_IMPL STREQUAL "win32api")
set(ZMQ_USE_CV_IMPL_WIN32API 1)
elseif(ZMQ_CV_IMPL STREQUAL "pthreads")
set(ZMQ_USE_CV_IMPL_PTHREADS 1)
elseif(ZMQ_CV_IMPL STREQUAL "none")
set(ZMQ_USE_CV_IMPL_NONE 1)
else()
message(ERROR "Unknown value for ZMQ_CV_IMPL: ${ZMQ_CV_IMPL}")
endif()
# ##################### END condition_variable_t selection
if(NOT MSVC)
check_include_files(ifaddrs.h ZMQ_HAVE_IFADDRS)
check_include_files(sys/uio.h ZMQ_HAVE_UIO)
check_include_files(sys/eventfd.h ZMQ_HAVE_EVENTFD)
if(ZMQ_HAVE_EVENTFD AND NOT CMAKE_CROSSCOMPILING)
zmq_check_efd_cloexec()
endif()
endif()
if(ZMQ_HAVE_WINDOWS)
# Cannot use check_library_exists because the symbol is always declared as char(*)(void)
set(CMAKE_REQUIRED_LIBRARIES "ws2_32.lib")
check_cxx_symbol_exists(WSAStartup "winsock2.h" HAVE_WS2_32)
if(HAVE_WS2_32)
set(pkg_config_libs_private "${pkg_config_libs_private} -lws2_32")
endif()
set(CMAKE_REQUIRED_LIBRARIES "rpcrt4.lib")
check_cxx_symbol_exists(UuidCreateSequential "rpc.h" HAVE_RPCRT4)
set(CMAKE_REQUIRED_LIBRARIES "iphlpapi.lib")
check_cxx_symbol_exists(GetAdaptersAddresses "winsock2.h;iphlpapi.h" HAVE_IPHLAPI)
if(HAVE_IPHLAPI)
set(pkg_config_libs_private "${pkg_config_libs_private} -liphlpapi")
endif()
check_cxx_symbol_exists(if_nametoindex "iphlpapi.h" HAVE_IF_NAMETOINDEX)
set(CMAKE_REQUIRED_LIBRARIES "")
# TODO: This not the symbol we're looking for. What is the symbol?
check_library_exists(ws2 fopen "" HAVE_WS2)
else()
check_cxx_symbol_exists(if_nametoindex net/if.h HAVE_IF_NAMETOINDEX)
check_cxx_symbol_exists(SO_PEERCRED sys/socket.h ZMQ_HAVE_SO_PEERCRED)
check_cxx_symbol_exists(LOCAL_PEERCRED sys/socket.h ZMQ_HAVE_LOCAL_PEERCRED)
check_cxx_symbol_exists(SO_BUSY_POLL sys/socket.h ZMQ_HAVE_BUSY_POLL)
endif()
if(NOT MINGW)
find_library(RT_LIBRARY rt)
if(RT_LIBRARY)
set(pkg_config_libs_private "${pkg_config_libs_private} -lrt")
set(CMAKE_REQUIRED_LIBRARIES rt)
check_cxx_symbol_exists(clock_gettime time.h HAVE_CLOCK_GETTIME)
set(CMAKE_REQUIRED_LIBRARIES)
else()
check_cxx_symbol_exists(clock_gettime time.h HAVE_CLOCK_GETTIME)
endif()
endif()
find_package(Threads)
if(WIN32 AND NOT CYGWIN)
if(NOT HAVE_WS2_32 AND NOT HAVE_WS2)
message(FATAL_ERROR "Cannot link to ws2_32 or ws2")
endif()
if(NOT HAVE_RPCRT4)
message(FATAL_ERROR "Cannot link to rpcrt4")
endif()
if(NOT HAVE_IPHLAPI)
message(FATAL_ERROR "Cannot link to iphlapi")
endif()
endif()
if(NOT MSVC)
check_cxx_symbol_exists(fork unistd.h HAVE_FORK)
check_cxx_symbol_exists(gethrtime sys/time.h HAVE_GETHRTIME)
check_cxx_symbol_exists(mkdtemp "stdlib.h;unistd.h" HAVE_MKDTEMP)
check_cxx_symbol_exists(accept4 sys/socket.h HAVE_ACCEPT4)
check_cxx_symbol_exists(strnlen string.h HAVE_STRNLEN)
else()
set(HAVE_STRNLEN 1)
endif()
add_definitions(-D_REENTRANT -D_THREAD_SAFE)
add_definitions(-DZMQ_CUSTOM_PLATFORM_HPP)
option(ENABLE_EVENTFD "Enable/disable eventfd" ZMQ_HAVE_EVENTFD)
macro(zmq_check_cxx_flag_prepend flag)
check_cxx_compiler_flag("${flag}" HAVE_FLAG_${flag})
if(HAVE_FLAG_${flag})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
endif()
endmacro()
option(ENABLE_ANALYSIS "Build with static analysis(make take very long)" OFF)
if(MSVC)
if(ENABLE_ANALYSIS)
zmq_check_cxx_flag_prepend("/W4")
zmq_check_cxx_flag_prepend("/analyze")
# C++11/14/17-specific, but maybe possible via conditional defines
zmq_check_cxx_flag_prepend("/wd26440") # Function '...' can be declared 'noexcept'
zmq_check_cxx_flag_prepend("/wd26432") # If you define or delete any default operation in the type '...', define or
# delete them all
zmq_check_cxx_flag_prepend("/wd26439") # This kind of function may not throw. Declare it 'noexcept'
zmq_check_cxx_flag_prepend("/wd26447") # The function is declared 'noexcept' but calls function '...' which may
# throw exceptions
zmq_check_cxx_flag_prepend("/wd26433") # Function '...' should be marked with 'override'
zmq_check_cxx_flag_prepend("/wd26409") # Avoid calling new and delete explicitly, use std::make_unique<T> instead
# Requires GSL
zmq_check_cxx_flag_prepend("/wd26429") # Symbol '...' is never tested for nullness, it can be marked as not_null
zmq_check_cxx_flag_prepend("/wd26446") # Prefer to use gsl::at()
zmq_check_cxx_flag_prepend("/wd26481") # Don't use pointer arithmetic. Use span instead
zmq_check_cxx_flag_prepend("/wd26472") # Don't use a static_cast for arithmetic conversions. Use brace
# initialization, gsl::narrow_cast or gsl::narow
zmq_check_cxx_flag_prepend("/wd26448") # Consider using gsl::finally if final action is intended
zmq_check_cxx_flag_prepend("/wd26400") # Do not assign the result of an allocation or a function call with an
# owner<T> return value to a raw pointer, use owner<T> instead
zmq_check_cxx_flag_prepend("/wd26485") # Expression '...': No array to pointer decay(bounds.3)
else()
zmq_check_cxx_flag_prepend("/W3")
endif()
if(MSVC_IDE)
set(MSVC_TOOLSET "-${CMAKE_VS_PLATFORM_TOOLSET}")
else()
set(MSVC_TOOLSET "")
endif()
else()
zmq_check_cxx_flag_prepend("-Wall")
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
zmq_check_cxx_flag_prepend("-Wextra")
endif()
option(LIBZMQ_PEDANTIC "" ON)
option(LIBZMQ_WERROR "" OFF)
# TODO: why is -Wno-long-long defined differently than in configure.ac?
if(NOT MSVC)
zmq_check_cxx_flag_prepend("-Wno-long-long")
zmq_check_cxx_flag_prepend("-Wno-uninitialized")
if(LIBZMQ_PEDANTIC)
zmq_check_cxx_flag_prepend("-pedantic")
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Intel")
zmq_check_cxx_flag_prepend("-strict-ansi")
endif()
if(${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
zmq_check_cxx_flag_prepend("-compat=5")
endif()
endif()
endif()
if(LIBZMQ_WERROR)
if(MSVC)
zmq_check_cxx_flag_prepend("/WX")
else()
zmq_check_cxx_flag_prepend("-Werror")
if(${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
zmq_check_cxx_flag_prepend("-errwarn=%all")
endif()
endif()
endif()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
zmq_check_cxx_flag_prepend("-mcpu=v9")
endif()
if(${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
zmq_check_cxx_flag_prepend("-features=zla")
endif()
if(CMAKE_SYSTEM_NAME MATCHES "SunOS"
OR CMAKE_SYSTEM_NAME MATCHES "NetBSD"
OR CMAKE_SYSTEM_NAME MATCHES "QNX")
message(STATUS "Checking whether atomic operations can be used")
check_c_source_compiles(
"\
#include <atomic.h> \
\
int main() \
{ \
uint32_t value; \
atomic_cas_32(&value, 0, 0); \
return 0; \
} \
"
HAVE_ATOMIC_H)
if(NOT HAVE_ATOMIC_H)
set(ZMQ_FORCE_MUTEXES 1)
endif()
endif()
if(NOT ANDROID)
zmq_check_noexcept()
endif()
# -----------------------------------------------------------------------------
if (NOT MSVC)
# Compilation checks
zmq_check_pthread_setname()
zmq_check_pthread_setaffinity()
# Execution checks
if(NOT CMAKE_CROSSCOMPILING)
zmq_check_sock_cloexec()
zmq_check_o_cloexec()
zmq_check_so_bindtodevice()
zmq_check_so_keepalive()
zmq_check_so_priority()
zmq_check_tcp_keepcnt()
zmq_check_tcp_keepidle()
zmq_check_tcp_keepintvl()
zmq_check_tcp_keepalive()
zmq_check_tcp_tipc()
zmq_check_getrandom()
endif()
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux"
OR CMAKE_SYSTEM_NAME MATCHES "GNU/kFreeBSD"
OR CMAKE_SYSTEM_NAME MATCHES "GNU/Hurd"
OR CYGWIN)
add_definitions(-D_GNU_SOURCE)
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
add_definitions(-D__BSD_VISIBLE)
elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
add_definitions(-D_NETBSD_SOURCE)
elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
add_definitions(-D_OPENBSD_SOURCE)
elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
add_definitions(-D_PTHREADS)
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
add_definitions(-D_POSIX_C_SOURCE=200112L)
zmq_check_cxx_flag_prepend(-Ae)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_definitions(-D_DARWIN_C_SOURCE)
endif()
find_package(AsciiDoctor)
cmake_dependent_option(WITH_DOC "Build Reference Guide documentation(requires DocBook)" ON "ASCIIDOC_FOUND;NOT WIN32"
OFF) # Do not build docs on Windows due to issues with symlinks
if(MSVC)
if(WITH_OPENPGM)
# set(OPENPGM_ROOT "" CACHE PATH "Location of OpenPGM")
set(OPENPGM_VERSION_MAJOR 5)
set(OPENPGM_VERSION_MINOR 2)
set(OPENPGM_VERSION_MICRO 122)
if(CMAKE_CL_64)
find_path(
OPENPGM_ROOT include/pgm/pgm.h
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
NO_DEFAULT_PATH)
message(STATUS "OpenPGM x64 detected - ${OPENPGM_ROOT}")
else()
find_path(
OPENPGM_ROOT include/pgm/pgm.h
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
NO_DEFAULT_PATH)
message(STATUS "OpenPGM x86 detected - ${OPENPGM_ROOT}")
endif()
set(OPENPGM_INCLUDE_DIRS ${OPENPGM_ROOT}/include)
set(OPENPGM_LIBRARY_DIRS ${OPENPGM_ROOT}/lib)
set(OPENPGM_LIBRARIES
optimized
libpgm${MSVC_TOOLSET}-mt-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib debug
libpgm${MSVC_TOOLSET}-mt-gd-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib)
endif()
else()
if(WITH_OPENPGM)
# message(FATAL_ERROR "WITH_OPENPGM not implemented")
if(NOT OPENPGM_PKGCONFIG_NAME)
set(OPENPGM_PKGCONFIG_NAME "openpgm-5.2")
endif()
set(OPENPGM_PKGCONFIG_NAME
${OPENPGM_PKGCONFIG_NAME}
CACHE STRING "Name pkg-config shall use to find openpgm libraries and include paths" FORCE)
pkg_check_modules(OPENPGM ${OPENPGM_PKGCONFIG_NAME})
if(OPENPGM_FOUND)
message(STATUS ${OPENPGM_PKGCONFIG_NAME}" found")
set(pkg_config_names_private "${pkg_config_names_private} ${OPENPGM_PKGCONFIG_NAME}")
else()
message(
FATAL_ERROR
${OPENPGM_PKGCONFIG_NAME}" not found. openpgm is searchd via `pkg-config ${OPENPGM_PKGCONFIG_NAME}`. Consider providing a valid OPENPGM_PKGCONFIG_NAME"
)
endif()
# DSO symbol visibility for openpgm
if(HAVE_FLAG_VISIBILITY_HIDDEN)
elseif(HAVE_FLAG_LDSCOPE_HIDDEN)
endif()
endif()
endif()
# -----------------------------------------------------------------------------
# force off-tree build
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
message(
FATAL_ERROR
"CMake generation is not allowed within the source directory! \
Remove the CMakeCache.txt file and try again from another folder, e.g.: \
\
rm CMakeCache.txt \
mkdir cmake-make \
cd cmake-make \
cmake ..")
endif()
# -----------------------------------------------------------------------------
# default to Release build
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
# CMAKE_BUILD_TYPE is not used for multi-configuration generators like Visual Studio/XCode which instead use
# CMAKE_CONFIGURATION_TYPES
set(CMAKE_BUILD_TYPE
Release
CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()
# -----------------------------------------------------------------------------
# output directories
zmq_set_with_default(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${ZeroMQ_BINARY_DIR}/bin")
if(UNIX)
set(zmq_library_directory "lib")
else()
set(zmq_library_directory "bin")
endif()
zmq_set_with_default(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${ZeroMQ_BINARY_DIR}/${zmq_library_directory}")
zmq_set_with_default(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${ZeroMQ_BINARY_DIR}/lib")
# -----------------------------------------------------------------------------
# platform specifics
if(WIN32)
# Socket limit is 16K(can be raised arbitrarily)
add_definitions(-DFD_SETSIZE=16384)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
endif()
if(MSVC)
# Parallel make.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
# Compile the static lib with debug information included note: we assume here that the default flags contain some /Z
# flag
string(REGEX REPLACE "/Z.[^:]" "/Z7 " CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REGEX REPLACE "/Z.[^:]" "/Z7 " CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endif()
# -----------------------------------------------------------------------------
# source files
set(cxx-sources
precompiled.cpp
address.cpp
channel.cpp
client.cpp
clock.cpp
ctx.cpp
curve_mechanism_base.cpp
curve_client.cpp
curve_server.cpp
dealer.cpp
devpoll.cpp
dgram.cpp
dist.cpp
endpoint.cpp
epoll.cpp
err.cpp
fq.cpp
io_object.cpp
io_thread.cpp
ip.cpp
ipc_address.cpp
ipc_connecter.cpp
ipc_listener.cpp
kqueue.cpp
lb.cpp
mailbox.cpp
mailbox_safe.cpp
mechanism.cpp
mechanism_base.cpp
metadata.cpp
msg.cpp
mtrie.cpp
norm_engine.cpp
object.cpp
options.cpp
own.cpp
null_mechanism.cpp
pair.cpp
peer.cpp
pgm_receiver.cpp
pgm_sender.cpp
pgm_socket.cpp
pipe.cpp
plain_client.cpp
plain_server.cpp
poll.cpp
poller_base.cpp
polling_util.cpp
pollset.cpp
proxy.cpp
pub.cpp
pull.cpp
push.cpp
random.cpp
raw_encoder.cpp
raw_decoder.cpp
raw_engine.cpp
reaper.cpp
rep.cpp
req.cpp
router.cpp
select.cpp
server.cpp
session_base.cpp
signaler.cpp
socket_base.cpp
socks.cpp
socks_connecter.cpp
stream.cpp
stream_engine_base.cpp
sub.cpp
tcp.cpp
tcp_address.cpp