blob: a73b3e6f7729311f0290b66e58393bdf49c1a862 [file] [log] [blame]
James E. King III3ae30422018-03-12 07:33:22 -04001#
Pascal Bachd5f87e12014-12-12 15:59:17 +01002# Licensed to the Apache Software Foundation (ASF) under one
3# or more contributor license agreements. See the NOTICE file
4# distributed with this work for additional information
5# regarding copyright ownership. The ASF licenses this file
6# to you under the Apache License, Version 2.0 (the
7# "License"); you may not use this file except in compliance
8# with the License. You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing,
13# software distributed under the License is distributed on an
14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15# KIND, either express or implied. See the License for the
16# specific language governing permissions and limitations
17# under the License.
18#
19
James E. King IIIc9ac8d22019-01-07 16:46:45 -050020# Unit tests still require boost
21include(BoostMacros)
22REQUIRE_BOOST_HEADERS()
Mario Emmenlauerb0136812021-08-02 21:55:34 +020023set(BOOST_COMPONENTS filesystem thread unit_test_framework chrono)
James E. King IIIc9ac8d22019-01-07 16:46:45 -050024REQUIRE_BOOST_LIBRARIES(BOOST_COMPONENTS)
Pascal Bachd5f87e12014-12-12 15:59:17 +010025
James E. King IIIc9ac8d22019-01-07 16:46:45 -050026include(ThriftMacros)
James E. King, III7edc8fa2017-01-20 10:11:41 -050027
28# Make sure gen-cpp files can be included
Pascal Bachd5f87e12014-12-12 15:59:17 +010029include_directories("${CMAKE_CURRENT_BINARY_DIR}")
30
31# Create the thrift C++ test library
32set(testgencpp_SOURCES
James E. King, IIIb4c190b2017-02-13 16:39:59 -050033 gen-cpp/AnnotationTest_types.cpp
34 gen-cpp/AnnotationTest_types.h
Pascal Bachd5f87e12014-12-12 15:59:17 +010035 gen-cpp/DebugProtoTest_types.cpp
36 gen-cpp/DebugProtoTest_types.h
37 gen-cpp/EnumTest_types.cpp
38 gen-cpp/EnumTest_types.h
39 gen-cpp/OptionalRequiredTest_types.cpp
40 gen-cpp/OptionalRequiredTest_types.h
41 gen-cpp/Recursive_types.cpp
42 gen-cpp/Recursive_types.h
43 gen-cpp/ThriftTest_types.cpp
44 gen-cpp/ThriftTest_types.h
Chet Murthyad08a8b2017-12-19 15:55:56 -080045 gen-cpp/OneWayTest_types.h
46 gen-cpp/OneWayService.cpp
47 gen-cpp/OneWayService.h
Pascal Bachd5f87e12014-12-12 15:59:17 +010048 gen-cpp/TypedefTest_types.cpp
49 gen-cpp/TypedefTest_types.h
Sven Roederer4f5bfd82024-07-17 15:27:24 +020050 gen-cpp/Thrift5272_types.cpp
51 gen-cpp/Thrift5272_types.h
Pascal Bachd5f87e12014-12-12 15:59:17 +010052 ThriftTest_extras.cpp
53 DebugProtoTest_extras.cpp
54)
55
56add_library(testgencpp STATIC ${testgencpp_SOURCES})
Pascal Bachd5f87e12014-12-12 15:59:17 +010057
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +090058set(testgencpp_cob_SOURCES
Pascal Bachd5f87e12014-12-12 15:59:17 +010059 gen-cpp/ChildService.cpp
60 gen-cpp/ChildService.h
Ben Craig1684c422015-04-24 08:52:44 -050061 gen-cpp/EmptyService.cpp
62 gen-cpp/EmptyService.h
Pascal Bachd5f87e12014-12-12 15:59:17 +010063 gen-cpp/ParentService.cpp
64 gen-cpp/ParentService.h
65 gen-cpp/proc_types.cpp
66 gen-cpp/proc_types.h
67)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +090068add_library(testgencpp_cob STATIC ${testgencpp_cob_SOURCES})
Pascal Bachd5f87e12014-12-12 15:59:17 +010069
Pascal Bachd5f87e12014-12-12 15:59:17 +010070add_executable(Benchmark Benchmark.cpp)
71target_link_libraries(Benchmark testgencpp)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +020072target_link_libraries(Benchmark thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +010073add_test(NAME Benchmark COMMAND Benchmark)
Nobuaki Sukegawae8c71d82015-11-23 19:51:37 +090074target_link_libraries(Benchmark testgencpp)
Pascal Bachd5f87e12014-12-12 15:59:17 +010075
76set(UnitTest_SOURCES
77 UnitTestMain.cpp
Chet Murthyad08a8b2017-12-19 15:55:56 -080078 OneWayHTTPTest.cpp
Pascal Bachd5f87e12014-12-12 15:59:17 +010079 TMemoryBufferTest.cpp
80 TBufferBaseTest.cpp
81 Base64Test.cpp
82 ToStringTest.cpp
83 TypedefTest.cpp
Roger Meier3815e0b2015-04-04 16:26:30 +020084 TServerSocketTest.cpp
Ben Craig1684c422015-04-24 08:52:44 -050085 TServerTransportTest.cpp
zeshuai00786352b42020-06-15 17:00:33 +080086 ThrifttReadCheckTests.cpp
CJCombrink4b909092024-04-27 19:51:39 +020087 TUuidTest.cpp
Sven Roederer4f5bfd82024-07-17 15:27:24 +020088 Thrift5272.cpp
Pascal Bachd5f87e12014-12-12 15:59:17 +010089)
90
Pascal Bachd5f87e12014-12-12 15:59:17 +010091add_executable(UnitTests ${UnitTest_SOURCES})
Nobuaki Sukegawae8c71d82015-11-23 19:51:37 +090092target_link_libraries(UnitTests testgencpp ${Boost_LIBRARIES})
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +020093target_link_libraries(UnitTests thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +010094add_test(NAME UnitTests COMMAND UnitTests)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +010095if(MSVC)
ben-craigfae08e72015-07-15 11:34:47 -050096 # Disable C4503: decorated name length exceeded, name was truncated
97 # 'insanity' results in very long decorated names
98 set_property( TARGET UnitTests APPEND_STRING PROPERTY COMPILE_FLAGS /wd4503 )
Mario Emmenlauer9fab2382021-02-04 21:10:43 +010099endif()
Pascal Bachd5f87e12014-12-12 15:59:17 +0100100
CJCombrink4b909092024-04-27 19:51:39 +0200101# Test the THRIFT_TUUID_SUPPORT_BOOST_UUID compiler directive globally set on the target
102add_executable(UnitTestsUuid
103 UnitTestMain.cpp
104 TUuidTestBoost.cpp
105)
106target_link_libraries(UnitTestsUuid testgencpp ${Boost_LIBRARIES})
107target_link_libraries(UnitTestsUuid thrift)
108target_compile_definitions(UnitTestsUuid PUBLIC THRIFT_TUUID_SUPPORT_BOOST_UUID)
109add_test(NAME UnitTestsUuid COMMAND UnitTestsUuid)
110
111# Test not setting the THRIFT_TUUID_SUPPORT_BOOST_UUID compiler directive as with the test above.
112# The test does set the directive before including the thrift header to test the behaviour
113add_executable(UnitTestsUuidNoDirective
114 UnitTestMain.cpp
115 TUuidTestBoostNoDirective.cpp
116)
117target_link_libraries(UnitTestsUuidNoDirective testgencpp ${Boost_LIBRARIES})
118target_link_libraries(UnitTestsUuidNoDirective thrift)
119add_test(NAME UnitTestsUuidNoDirective COMMAND UnitTestsUuidNoDirective)
ben-craigaf2d9c82015-07-16 08:11:21 -0500120
Martin Haimberger0ad6ee92015-11-13 03:18:50 -0800121set( TInterruptTest_SOURCES
122 TSocketInterruptTest.cpp
123 TSSLSocketInterruptTest.cpp
124)
ben-craigaf2d9c82015-07-16 08:11:21 -0500125if (WIN32)
126 list(APPEND TInterruptTest_SOURCES
127 TPipeInterruptTest.cpp
128 )
129endif()
130add_executable(TInterruptTest ${TInterruptTest_SOURCES})
131target_link_libraries(TInterruptTest
Ben Craig1684c422015-04-24 08:52:44 -0500132 testgencpp
133 ${Boost_LIBRARIES}
Ben Craig1684c422015-04-24 08:52:44 -0500134)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200135target_link_libraries(TInterruptTest thrift)
Antonio Di Monaco796667b2016-01-04 23:05:19 +0100136if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100137 target_link_libraries(TInterruptTest -lrt)
Ben Craig1684c422015-04-24 08:52:44 -0500138endif ()
James E. King, III07f59972017-03-10 06:18:33 -0500139add_test(NAME TInterruptTest COMMAND TInterruptTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
Ben Craig1684c422015-04-24 08:52:44 -0500140
141add_executable(TServerIntegrationTest TServerIntegrationTest.cpp)
142target_link_libraries(TServerIntegrationTest
143 testgencpp_cob
144 ${Boost_LIBRARIES}
145)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200146target_link_libraries(TServerIntegrationTest thrift)
Antonio Di Monaco796667b2016-01-04 23:05:19 +0100147if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100148 target_link_libraries(TServerIntegrationTest -lrt)
Ben Craig1684c422015-04-24 08:52:44 -0500149endif ()
150add_test(NAME TServerIntegrationTest COMMAND TServerIntegrationTest)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100151
152if(WITH_ZLIB)
Nobuaki Sukegawa3e5b9c22016-02-22 21:47:23 +0900153include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}")
Pascal Bachd5f87e12014-12-12 15:59:17 +0100154add_executable(TransportTest TransportTest.cpp)
155target_link_libraries(TransportTest
156 testgencpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100157 ${Boost_LIBRARIES}
158 ${ZLIB_LIBRARIES}
159)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200160target_link_libraries(TransportTest thrift)
161target_link_libraries(TransportTest thriftz)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100162add_test(NAME TransportTest COMMAND TransportTest)
163
164add_executable(ZlibTest ZlibTest.cpp)
165target_link_libraries(ZlibTest
166 testgencpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100167 ${Boost_LIBRARIES}
168 ${ZLIB_LIBRARIES}
169)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200170target_link_libraries(ZlibTest thrift)
171target_link_libraries(ZlibTest thriftz)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100172add_test(NAME ZlibTest COMMAND ZlibTest)
173endif(WITH_ZLIB)
174
James E. King, IIIb4c190b2017-02-13 16:39:59 -0500175add_executable(AnnotationTest AnnotationTest.cpp)
176target_link_libraries(AnnotationTest
177 testgencpp
178 ${Boost_LIBRARIES}
179)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200180target_link_libraries(AnnotationTest thrift)
James E. King, IIIb4c190b2017-02-13 16:39:59 -0500181add_test(NAME AnnotationTest COMMAND AnnotationTest)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100182
183add_executable(EnumTest EnumTest.cpp)
184target_link_libraries(EnumTest
185 testgencpp
186 ${Boost_LIBRARIES}
187)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200188target_link_libraries(EnumTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100189add_test(NAME EnumTest COMMAND EnumTest)
190
Jim King9de9b1f2015-04-30 16:03:34 -0400191if(HAVE_GETOPT_H)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100192add_executable(TFileTransportTest TFileTransportTest.cpp)
193target_link_libraries(TFileTransportTest
194 testgencpp
195 ${Boost_LIBRARIES}
196)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200197target_link_libraries(TFileTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100198add_test(NAME TFileTransportTest COMMAND TFileTransportTest)
Jim King9de9b1f2015-04-30 16:03:34 -0400199endif()
Pascal Bachd5f87e12014-12-12 15:59:17 +0100200
201add_executable(TFDTransportTest TFDTransportTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200202target_link_libraries(TFDTransportTest
203 ${Boost_LIBRARIES}
204)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200205target_link_libraries(TFDTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100206add_test(NAME TFDTransportTest COMMAND TFDTransportTest)
207
208add_executable(TPipedTransportTest TPipedTransportTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200209target_link_libraries(TPipedTransportTest
210 ${Boost_LIBRARIES}
211)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200212target_link_libraries(TPipedTransportTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100213add_test(NAME TPipedTransportTest COMMAND TPipedTransportTest)
214
215set(AllProtocolsTest_SOURCES
216 AllProtocolTests.cpp
217 AllProtocolTests.tcc
Mario Emmenlauerf97176b2022-01-21 22:55:28 +0100218 GenericHelpers.h
219)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100220
221add_executable(AllProtocolsTest ${AllProtocolsTest_SOURCES})
Claudius Heine5ef662b2015-06-24 10:03:50 +0200222target_link_libraries(AllProtocolsTest
223 testgencpp
224 ${Boost_LIBRARIES}
225)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200226target_link_libraries(AllProtocolsTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100227add_test(NAME AllProtocolsTest COMMAND AllProtocolsTest)
228
Jim King9de9b1f2015-04-30 16:03:34 -0400229# The debug run-time in Windows asserts on isprint() with negative inputs
230if (NOT MSVC OR (MSVC AND CMAKE_BUILD_TYPE EQUAL "DEBUG"))
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100231 add_executable(DebugProtoTest DebugProtoTest.cpp)
232 target_link_libraries(DebugProtoTest
233 testgencpp
234 ${Boost_LIBRARIES}
235 )
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200236 target_link_libraries(DebugProtoTest thrift)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100237 add_test(NAME DebugProtoTest COMMAND DebugProtoTest)
Jim King9de9b1f2015-04-30 16:03:34 -0400238endif()
Pascal Bachd5f87e12014-12-12 15:59:17 +0100239
240add_executable(JSONProtoTest JSONProtoTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200241target_link_libraries(JSONProtoTest
242 testgencpp
243 ${Boost_LIBRARIES}
244)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200245target_link_libraries(JSONProtoTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100246add_test(NAME JSONProtoTest COMMAND JSONProtoTest)
247
248add_executable(OptionalRequiredTest OptionalRequiredTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200249target_link_libraries(OptionalRequiredTest
250 testgencpp
251 ${Boost_LIBRARIES}
252)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200253target_link_libraries(OptionalRequiredTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100254add_test(NAME OptionalRequiredTest COMMAND OptionalRequiredTest)
255
256add_executable(RecursiveTest RecursiveTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200257target_link_libraries(RecursiveTest
258 testgencpp
259 ${Boost_LIBRARIES}
260)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200261target_link_libraries(RecursiveTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100262add_test(NAME RecursiveTest COMMAND RecursiveTest)
263
264add_executable(SpecializationTest SpecializationTest.cpp)
Claudius Heine5ef662b2015-06-24 10:03:50 +0200265target_link_libraries(SpecializationTest
266 testgencpp
267 ${Boost_LIBRARIES}
268)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200269target_link_libraries(SpecializationTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100270add_test(NAME SpecializationTest COMMAND SpecializationTest)
271
272set(concurrency_test_SOURCES
273 concurrency/Tests.cpp
274 concurrency/ThreadFactoryTests.h
275 concurrency/ThreadManagerTests.h
276 concurrency/TimerManagerTests.h
277)
278add_executable(concurrency_test ${concurrency_test_SOURCES})
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200279target_link_libraries(concurrency_test thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100280add_test(NAME concurrency_test COMMAND concurrency_test)
281
282set(link_test_SOURCES
283 link/LinkTest.cpp
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900284 gen-cpp/ParentService.h
Pascal Bachd5f87e12014-12-12 15:59:17 +0100285 link/TemplatedService1.cpp
286 link/TemplatedService2.cpp
Pascal Bachd5f87e12014-12-12 15:59:17 +0100287)
Nobuaki Sukegawa6304a532014-12-18 01:30:58 +0900288
Pascal Bachd5f87e12014-12-12 15:59:17 +0100289add_executable(link_test ${link_test_SOURCES})
Jim King9de9b1f2015-04-30 16:03:34 -0400290target_link_libraries(link_test testgencpp_cob)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200291target_link_libraries(link_test thrift)
Nobuaki Sukegawae8c71d82015-11-23 19:51:37 +0900292target_link_libraries(link_test testgencpp)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100293add_test(NAME link_test COMMAND link_test)
294
295if(WITH_LIBEVENT)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100296 set(processor_test_SOURCES
297 processor/ProcessorTest.cpp
298 processor/EventLog.cpp
299 processor/ServerThread.cpp
300 processor/EventLog.h
301 processor/Handlers.h
302 processor/ServerThread.h
303 )
304 add_executable(processor_test ${processor_test_SOURCES})
305 target_link_libraries(processor_test
306 testgencpp_cob
307 ${Boost_LIBRARIES}
308 )
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200309 target_link_libraries(processor_test thriftnb)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100310 add_test(NAME processor_test COMMAND processor_test)
Nobuaki Sukegawa8016af82015-01-02 23:14:22 +0900311
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100312 set(TNonblockingServerTest_SOURCES TNonblockingServerTest.cpp)
313 add_executable(TNonblockingServerTest ${TNonblockingServerTest_SOURCES})
314 include_directories(${LIBEVENT_INCLUDE_DIRS})
315 target_link_libraries(TNonblockingServerTest
316 testgencpp_cob
317 ${Boost_LIBRARIES}
318 )
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200319 target_link_libraries(TNonblockingServerTest thriftnb)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100320 add_test(NAME TNonblockingServerTest COMMAND TNonblockingServerTest)
James E. King, III82ae9572017-08-05 12:23:54 -0400321
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100322 if(OPENSSL_FOUND AND WITH_OPENSSL)
323 set(TNonblockingSSLServerTest_SOURCES TNonblockingSSLServerTest.cpp)
324 add_executable(TNonblockingSSLServerTest ${TNonblockingSSLServerTest_SOURCES})
325 include_directories(${LIBEVENT_INCLUDE_DIRS})
326 target_link_libraries(TNonblockingSSLServerTest
327 testgencpp_cob
328 ${Boost_LIBRARIES}
329 )
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200330 target_link_libraries(TNonblockingSSLServerTest thriftnb)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100331 add_test(NAME TNonblockingSSLServerTest COMMAND TNonblockingSSLServerTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
332 endif(OPENSSL_FOUND AND WITH_OPENSSL)
333endif()
Pascal Bachd5f87e12014-12-12 15:59:17 +0100334
335if(OPENSSL_FOUND AND WITH_OPENSSL)
336add_executable(OpenSSLManualInitTest OpenSSLManualInitTest.cpp)
337target_link_libraries(OpenSSLManualInitTest
Pascal Bachd5f87e12014-12-12 15:59:17 +0100338 ${OPENSSL_LIBRARIES}
339 ${Boost_LIBRARIES}
340)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200341target_link_libraries(OpenSSLManualInitTest thrift)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100342add_test(NAME OpenSSLManualInitTest COMMAND OpenSSLManualInitTest)
Sergei Nikulov34e0bb62015-09-02 13:06:22 +0300343
344add_executable(SecurityTest SecurityTest.cpp)
345target_link_libraries(SecurityTest
346 testgencpp
347 ${Boost_LIBRARIES}
348)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200349target_link_libraries(SecurityTest thrift)
Antonio Di Monaco796667b2016-01-04 23:05:19 +0100350if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100351 target_link_libraries(SecurityTest -lrt)
Sergei Nikulov34e0bb62015-09-02 13:06:22 +0300352endif ()
James E. King, III07f59972017-03-10 06:18:33 -0500353add_test(NAME SecurityTest COMMAND SecurityTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
Sergei Nikulov34e0bb62015-09-02 13:06:22 +0300354
Mario Emmenlauer0f14e2f2019-10-15 11:25:10 +0200355add_executable(SecurityFromBufferTest SecurityFromBufferTest.cpp)
356target_link_libraries(SecurityFromBufferTest
357 testgencpp
358 ${Boost_LIBRARIES}
359)
Mario Emmenlauerbdb54bc2021-08-31 14:00:16 +0200360target_link_libraries(SecurityFromBufferTest thrift)
Mario Emmenlauer0f14e2f2019-10-15 11:25:10 +0200361if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100362 target_link_libraries(SecurityFromBufferTest -lrt)
Mario Emmenlauer0f14e2f2019-10-15 11:25:10 +0200363endif ()
364add_test(NAME SecurityFromBufferTest COMMAND SecurityFromBufferTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys")
365
Pascal Bachd5f87e12014-12-12 15:59:17 +0100366endif()
367
Nobuaki Sukegawa66228772014-12-07 21:45:33 +0900368if(WITH_QT5)
Mario Emmenlauer9fab2382021-02-04 21:10:43 +0100369 add_subdirectory(qt)
Nobuaki Sukegawa66228772014-12-07 21:45:33 +0900370endif()
371
Pascal Bachd5f87e12014-12-12 15:59:17 +0100372#
373# Common thrift code generation rules
374#
Sven Roederer4f5bfd82024-07-17 15:27:24 +0200375# files from /test
376#
Pascal Bachd5f87e12014-12-12 15:59:17 +0100377
James E. King, IIIb4c190b2017-02-13 16:39:59 -0500378add_custom_command(OUTPUT gen-cpp/AnnotationTest_constants.cpp
379 gen-cpp/AnnotationTest_constants.h
380 gen-cpp/AnnotationTest_types.cpp
381 gen-cpp/AnnotationTest_types.h
382 gen-cpp/foo_service.cpp
383 gen-cpp/foo_service.h
384 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/AnnotationTest.thrift
385)
Pascal Bachd5f87e12014-12-12 15:59:17 +0100386
James E. King, IIIb4c190b2017-02-13 16:39:59 -0500387add_custom_command(OUTPUT gen-cpp/DebugProtoTest_types.cpp gen-cpp/DebugProtoTest_types.h gen-cpp/EmptyService.cpp gen-cpp/EmptyService.h
CJCombrink1d886ca2024-03-23 21:32:28 +0100388 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/DebugProtoTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100389)
390
391add_custom_command(OUTPUT gen-cpp/EnumTest_types.cpp gen-cpp/EnumTest_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900392 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/EnumTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100393)
394
395add_custom_command(OUTPUT gen-cpp/TypedefTest_types.cpp gen-cpp/TypedefTest_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900396 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/TypedefTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100397)
398
399add_custom_command(OUTPUT gen-cpp/OptionalRequiredTest_types.cpp gen-cpp/OptionalRequiredTest_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900400 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/OptionalRequiredTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100401)
402
403add_custom_command(OUTPUT gen-cpp/Recursive_types.cpp gen-cpp/Recursive_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900404 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/Recursive.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100405)
406
407add_custom_command(OUTPUT gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900408 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/StressTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100409)
410
411add_custom_command(OUTPUT gen-cpp/SecondService.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_types.h
CJCombrink1d886ca2024-03-23 21:32:28 +0100412 COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100413)
414
Sven Roederer4f5bfd82024-07-17 15:27:24 +0200415# files from /lib/cpp/test
416
zeshuai00757c25072020-04-09 11:17:05 +0800417add_custom_command(OUTPUT gen-cpp/OneWayService.cpp gen-cpp/OneWayTest_types.h gen-cpp/OneWayService.h
Chet Murthyad08a8b2017-12-19 15:55:56 -0800418 COMMAND ${THRIFT_COMPILER} --gen cpp ${CMAKE_CURRENT_SOURCE_DIR}/OneWayTest.thrift
419)
420
Sven Roederer4f5bfd82024-07-17 15:27:24 +0200421add_custom_command(OUTPUT gen-cpp/Thrift5272_types.cpp gen-cpp/Thrift5272_types.h
422 COMMAND ${THRIFT_COMPILER} --gen cpp ${CMAKE_CURRENT_SOURCE_DIR}/Thrift5272.thrift
423)
424
Pascal Bachd5f87e12014-12-12 15:59:17 +0100425add_custom_command(OUTPUT gen-cpp/ChildService.cpp gen-cpp/ChildService.h gen-cpp/ParentService.cpp gen-cpp/ParentService.h gen-cpp/proc_types.cpp gen-cpp/proc_types.h
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900426 COMMAND ${THRIFT_COMPILER} --gen cpp:templates,cob_style ${CMAKE_CURRENT_SOURCE_DIR}/processor/proc.thrift
Pascal Bachd5f87e12014-12-12 15:59:17 +0100427)