Debian Codegraph @

unittest/gunit/xplugin/xcl/CMakeLists.txt

raw
1 # Copyright (c) 2020, 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
25 GET_DIRECTORY_PROPERTY(MYSQLX_CLIENT_FULL_LIB
26 DIRECTORY ${MYSQLX_PROJECT_DIR}
27 DEFINITION MYSQLX_CLIENT_FULL_LIB
28 )
29
30 GET_DIRECTORY_PROPERTY(MYSQLX_PROTOCOL_FULL_LIB
31 DIRECTORY ${MYSQLX_PROJECT_DIR}
32 DEFINITION MYSQLX_PROTOCOL_FULL_LIB
33 )
34
35 SET(XCL_UNIT_TESTS xclient_unit_tests)
36
37 INCLUDE(source_files.cmake)
38
39 # There may be extra semicolons in code generated by protobuf.
40 MY_CHECK_CXX_COMPILER_WARNING("-Wextra-semi" HAS_WARN_FLAG)
41 IF(HAS_WARN_FLAG)
42 STRING_APPEND(CMAKE_CXX_FLAGS " ${HAS_WARN_FLAG}")
43 ENDIF()
44
45 # Fixes "C1128: number of sections exceeded object file format limit" in MSVC
46 IF(MSVC)
47 ADD_COMPILE_FLAGS(
48 mock/mock.cc
49 COMPILE_FLAGS "/bigobj"
50 )
51 ENDIF()
52
53 MYSQL_ADD_EXECUTABLE(${XCL_UNIT_TESTS}
54 ../test_main.cc
55 ${XCL_TEST_SRC}
56 ADD_TEST xclient
57 )
58 SET_TESTS_PROPERTIES(xclient PROPERTIES TIMEOUT 180)
59
60 ADD_DEPENDENCIES(${XCL_UNIT_TESTS}
61 ${MYSQLX_CLIENT_FULL_LIB}
62 ${MYSQLX_PROTOCOL_FULL_LIB}
63 xprotocol_tags
64 )
65
66 TARGET_LINK_LIBRARIES(${XCL_UNIT_TESTS}
67 ${GCOV_LDFLAGS}
68 ${MYSQLX_CLIENT_FULL_LIB}
69 ${MYSQLX_PROTOCOL_FULL_LIB}
70 ext::libprotobuf
71 ext::lz4
72 mysqlclient
73 gtest
74 gmock
75 )