Debian Codegraph @

unittest/gunit/libmysqlgcs/CMakeLists.txt

raw
1 # Copyright (c) 2016, 2026, Oracle and/or its affiliates.
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License, version 2.0,
5 # as published by the Free Software Foundation.
6 #
7 # This program is designed to work with certain software (including
8 # but not limited to OpenSSL) that is licensed under separate terms,
9 # as designated in a particular file or component or in included license
10 # documentation. The authors of MySQL hereby grant you an additional
11 # permission to link the program and your derivative works with the
12 # separately licensed software that they have either included with
13 # the program or referenced in the documentation.
14 #
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License, version 2.0, for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
24 IF (DEFINED WITHOUT_GROUP_REPLICATION AND WITHOUT_GROUP_REPLICATION)
25 RETURN()
26 ENDIF()
27
28 INCLUDE_DIRECTORIES(
29 SYSTEM
30 ${CMAKE_SOURCE_DIR}/plugin/group_replication/libmysqlgcs/include
31 ${CMAKE_BINARY_DIR}/plugin/group_replication/libmysqlgcs/include
32 ${CMAKE_BINARY_DIR}/plugin/group_replication/libmysqlgcs
33 ${CMAKE_BINARY_DIR}/plugin/group_replication/libmysqlgcs/xdr_gen
34 ${CMAKE_SOURCE_DIR}/plugin/group_replication/libmysqlgcs/src/interface
35 ${CMAKE_SOURCE_DIR}/plugin/group_replication/libmysqlgcs/src/bindings/xcom
36 ${CMAKE_SOURCE_DIR}/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom
37 ${CMAKE_SOURCE_DIR}/unittest/gunit/libmysqlgcs/include)
38
39 IF(WIN32)
40 SET(XCOM_BASEDIR
41 ${CMAKE_SOURCE_DIR}/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom)
42 INCLUDE_DIRECTORIES(
43 ${XCOM_BASEDIR}/windeps/include
44 ${XCOM_BASEDIR}/windeps/sunrpc
45 ${XCOM_BASEDIR}/windeps/sunrpc/rpc)
46 ENDIF()
47
48 ###
49 ### Tests
50 ###
51
52 SET(GCS_INTERFACE_TESTS
53 interface/gcs_message
54 interface/gcs_tagged_lock)
55
56 SET(GCS_XCOM_TESTS
57 xcom/gcs_logging
58 xcom/gcs_logging_system
59 xcom/gcs_parameters
60 xcom/gcs_xcom_notification
61 xcom/gcs_xcom_utils
62 xcom/gcs_msg_stages
63 xcom/gcs_allowlist
64 xcom/gcs_xcom_group_management
65 xcom/gcs_xcom_state_exchange
66 xcom/gcs_packet
67 xcom/gcs_xcom_communication_interface
68 xcom/gcs_xcom_interface_unit
69 xcom/gcs_xcom_statistics_interface
70 xcom/gcs_xcom_group_member_information
71 xcom/gcs_mpsc_queue
72 xcom/gcs_xcom_input_queue
73 xcom/gcs_xcom_networking
74 xcom/gcs_xcom_xcom_base
75 xcom/gcs_xcom_xcom_transport
76 xcom/gcs_xcom_communication_protocol_changer
77 xcom/gcs_xcom_xcom_cache
78 xcom/gcs_xcom_control_interface
79 xcom/gcs_xcom_view_identifier
80 xcom/gcs_message_stage_fragmentation
81 xcom/gcs_xcom_site_def
82 xcom/gcs_xcom_expels_in_progress
83 xcom/gcs_xcom_network_provider
84 xcom/gcs_xcom_network_provider_manager
85 xcom/gcs_xcom_xcom_single_writer
86 )
87
88 # When binding using IPv6 the way XCom does (dual stack IPv4/IPv6), it
89 # does not detect that a port is busy when binding and overruns the
90 # previous port. As such, this test cannot run on Solaris
91 IF(SOLARIS)
92 LIST(REMOVE_ITEM GCS_XCOM_TESTS xcom/gcs_xcom_network_provider)
93 ENDIF()
94
95 IF(WIN32)
96 # UINT8_MAX: macro redefinition
97 ADD_COMPILE_FLAGS(xcom/gcs_xcom_site_def-t.cc COMPILE_FLAGS "/wd4005")
98 ENDIF()
99
100 ###
101 ### Configure the tests and add target
102 ###
103
104 FOREACH(tpath ${GCS_INTERFACE_TESTS} ${GCS_XCOM_TESTS})
105 GET_FILENAME_COMPONENT(test ${tpath} NAME)
106 MYSQL_ADD_EXECUTABLE(${test}-t ${tpath}-t.cc
107 ADD_TEST ${test}
108 ENABLE_EXPORTS
109 LINK_LIBRARIES gunit_small mysqlgcs ext::lz4
110 )
111 SET(GCS_UNIT_TESTS "${GCS_UNIT_TESTS}" "${test}-t")
112 IF(WIN32)
113 # Suppress linker warnings arising from linking to mysqlgcs and mysys
114 # LNK4217: symbol 'symbol' defined in 'f1.obj' is imported by 'f2.obj'...
115 # LNK4286: symbol 'symbol' defined in 'f1.obj' is imported by 'f2.obj'
116 MY_TARGET_LINK_OPTIONS(${test}-t "/ignore:4217 /ignore:4286")
117 ENDIF()
118 ENDFOREACH()
119
120 IF(MY_COMPILER_IS_CLANG)
121 STRING_APPEND(CMAKE_CXX_FLAGS " -Wno-deprecated")
122 ENDIF()
123
124 ADD_CUSTOM_TARGET(
125 libmysqlgcs-tests
126 DEPENDS
127 mysqlgcs
128 ext::lz4
129 ${GCS_UNIT_TESTS})