Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 1 | # |
| 2 | # 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 | |
Nobuaki Sukegawa | c444fb5 | 2015-01-02 23:16:55 +0900 | [diff] [blame] | 20 | include_directories(SYSTEM "${Boost_INCLUDE_DIRS}") |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 21 | |
James E. King, III | 7edc8fa | 2017-01-20 10:11:41 -0500 | [diff] [blame] | 22 | add_definitions("-D__STDC_LIMIT_MACROS") |
| 23 | |
| 24 | if (WITH_DYN_LINK_TEST) |
| 25 | add_definitions( -DBOOST_TEST_DYN_LINK ) |
| 26 | endif() |
| 27 | |
| 28 | # Make sure gen-cpp files can be included |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 29 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
| 30 | |
| 31 | # Create the thrift C++ test library |
| 32 | set(testgencpp_SOURCES |
James E. King, III | b4c190b | 2017-02-13 16:39:59 -0500 | [diff] [blame] | 33 | gen-cpp/AnnotationTest_types.cpp |
| 34 | gen-cpp/AnnotationTest_types.h |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 35 | 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 |
| 45 | gen-cpp/TypedefTest_types.cpp |
| 46 | gen-cpp/TypedefTest_types.h |
| 47 | ThriftTest_extras.cpp |
| 48 | DebugProtoTest_extras.cpp |
| 49 | ) |
| 50 | |
| 51 | add_library(testgencpp STATIC ${testgencpp_SOURCES}) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 52 | |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 53 | set(testgencpp_cob_SOURCES |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 54 | gen-cpp/ChildService.cpp |
| 55 | gen-cpp/ChildService.h |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 56 | gen-cpp/EmptyService.cpp |
| 57 | gen-cpp/EmptyService.h |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 58 | gen-cpp/ParentService.cpp |
| 59 | gen-cpp/ParentService.h |
| 60 | gen-cpp/proc_types.cpp |
| 61 | gen-cpp/proc_types.h |
| 62 | ) |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 63 | add_library(testgencpp_cob STATIC ${testgencpp_cob_SOURCES}) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 64 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 65 | add_executable(Benchmark Benchmark.cpp) |
| 66 | target_link_libraries(Benchmark testgencpp) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 67 | LINK_AGAINST_THRIFT_LIBRARY(Benchmark thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 68 | add_test(NAME Benchmark COMMAND Benchmark) |
Nobuaki Sukegawa | e8c71d8 | 2015-11-23 19:51:37 +0900 | [diff] [blame] | 69 | target_link_libraries(Benchmark testgencpp) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 70 | |
| 71 | set(UnitTest_SOURCES |
| 72 | UnitTestMain.cpp |
| 73 | TMemoryBufferTest.cpp |
| 74 | TBufferBaseTest.cpp |
| 75 | Base64Test.cpp |
| 76 | ToStringTest.cpp |
| 77 | TypedefTest.cpp |
Roger Meier | 3815e0b | 2015-04-04 16:26:30 +0200 | [diff] [blame] | 78 | TServerSocketTest.cpp |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 79 | TServerTransportTest.cpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 80 | ) |
| 81 | |
James E. King, III | 07f5997 | 2017-03-10 06:18:33 -0500 | [diff] [blame^] | 82 | if(NOT WITH_BOOSTTHREADS AND NOT WITH_STDTHREADS AND NOT MSVC AND NOT MINGW) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 83 | list(APPEND UnitTest_SOURCES RWMutexStarveTest.cpp) |
| 84 | endif() |
| 85 | |
| 86 | add_executable(UnitTests ${UnitTest_SOURCES}) |
Nobuaki Sukegawa | e8c71d8 | 2015-11-23 19:51:37 +0900 | [diff] [blame] | 87 | target_link_libraries(UnitTests testgencpp ${Boost_LIBRARIES}) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 88 | LINK_AGAINST_THRIFT_LIBRARY(UnitTests thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 89 | add_test(NAME UnitTests COMMAND UnitTests) |
ben-craig | fae08e7 | 2015-07-15 11:34:47 -0500 | [diff] [blame] | 90 | if ( MSVC ) |
| 91 | # Disable C4503: decorated name length exceeded, name was truncated |
| 92 | # 'insanity' results in very long decorated names |
| 93 | set_property( TARGET UnitTests APPEND_STRING PROPERTY COMPILE_FLAGS /wd4503 ) |
| 94 | endif ( MSVC ) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 95 | |
ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 96 | |
Martin Haimberger | 0ad6ee9 | 2015-11-13 03:18:50 -0800 | [diff] [blame] | 97 | set( TInterruptTest_SOURCES |
| 98 | TSocketInterruptTest.cpp |
| 99 | TSSLSocketInterruptTest.cpp |
| 100 | ) |
ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 101 | if (WIN32) |
| 102 | list(APPEND TInterruptTest_SOURCES |
| 103 | TPipeInterruptTest.cpp |
| 104 | ) |
| 105 | endif() |
| 106 | add_executable(TInterruptTest ${TInterruptTest_SOURCES}) |
| 107 | target_link_libraries(TInterruptTest |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 108 | testgencpp |
| 109 | ${Boost_LIBRARIES} |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 110 | ) |
ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 111 | LINK_AGAINST_THRIFT_LIBRARY(TInterruptTest thrift) |
Antonio Di Monaco | 796667b | 2016-01-04 23:05:19 +0100 | [diff] [blame] | 112 | if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW) |
ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 113 | target_link_libraries(TInterruptTest -lrt) |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 114 | endif () |
James E. King, III | 07f5997 | 2017-03-10 06:18:33 -0500 | [diff] [blame^] | 115 | add_test(NAME TInterruptTest COMMAND TInterruptTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys") |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 116 | |
| 117 | add_executable(TServerIntegrationTest TServerIntegrationTest.cpp) |
| 118 | target_link_libraries(TServerIntegrationTest |
| 119 | testgencpp_cob |
| 120 | ${Boost_LIBRARIES} |
| 121 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 122 | LINK_AGAINST_THRIFT_LIBRARY(TServerIntegrationTest thrift) |
Antonio Di Monaco | 796667b | 2016-01-04 23:05:19 +0100 | [diff] [blame] | 123 | if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW) |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 124 | target_link_libraries(TServerIntegrationTest -lrt) |
| 125 | endif () |
| 126 | add_test(NAME TServerIntegrationTest COMMAND TServerIntegrationTest) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 127 | |
| 128 | if(WITH_ZLIB) |
Nobuaki Sukegawa | 3e5b9c2 | 2016-02-22 21:47:23 +0900 | [diff] [blame] | 129 | include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}") |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 130 | add_executable(TransportTest TransportTest.cpp) |
| 131 | target_link_libraries(TransportTest |
| 132 | testgencpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 133 | ${Boost_LIBRARIES} |
| 134 | ${ZLIB_LIBRARIES} |
| 135 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 136 | LINK_AGAINST_THRIFT_LIBRARY(TransportTest thrift) |
| 137 | LINK_AGAINST_THRIFT_LIBRARY(TransportTest thriftz) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 138 | add_test(NAME TransportTest COMMAND TransportTest) |
| 139 | |
| 140 | add_executable(ZlibTest ZlibTest.cpp) |
| 141 | target_link_libraries(ZlibTest |
| 142 | testgencpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 143 | ${Boost_LIBRARIES} |
| 144 | ${ZLIB_LIBRARIES} |
| 145 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 146 | LINK_AGAINST_THRIFT_LIBRARY(ZlibTest thrift) |
| 147 | LINK_AGAINST_THRIFT_LIBRARY(ZlibTest thriftz) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 148 | add_test(NAME ZlibTest COMMAND ZlibTest) |
| 149 | endif(WITH_ZLIB) |
| 150 | |
James E. King, III | b4c190b | 2017-02-13 16:39:59 -0500 | [diff] [blame] | 151 | add_executable(AnnotationTest AnnotationTest.cpp) |
| 152 | target_link_libraries(AnnotationTest |
| 153 | testgencpp |
| 154 | ${Boost_LIBRARIES} |
| 155 | ) |
| 156 | LINK_AGAINST_THRIFT_LIBRARY(AnnotationTest thrift) |
| 157 | add_test(NAME AnnotationTest COMMAND AnnotationTest) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 158 | |
| 159 | add_executable(EnumTest EnumTest.cpp) |
| 160 | target_link_libraries(EnumTest |
| 161 | testgencpp |
| 162 | ${Boost_LIBRARIES} |
| 163 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 164 | LINK_AGAINST_THRIFT_LIBRARY(EnumTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 165 | add_test(NAME EnumTest COMMAND EnumTest) |
| 166 | |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 167 | if(HAVE_GETOPT_H) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 168 | add_executable(TFileTransportTest TFileTransportTest.cpp) |
| 169 | target_link_libraries(TFileTransportTest |
| 170 | testgencpp |
| 171 | ${Boost_LIBRARIES} |
| 172 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 173 | LINK_AGAINST_THRIFT_LIBRARY(TFileTransportTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 174 | add_test(NAME TFileTransportTest COMMAND TFileTransportTest) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 175 | endif() |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 176 | |
| 177 | add_executable(TFDTransportTest TFDTransportTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 178 | target_link_libraries(TFDTransportTest |
| 179 | ${Boost_LIBRARIES} |
| 180 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 181 | LINK_AGAINST_THRIFT_LIBRARY(TFDTransportTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 182 | add_test(NAME TFDTransportTest COMMAND TFDTransportTest) |
| 183 | |
| 184 | add_executable(TPipedTransportTest TPipedTransportTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 185 | target_link_libraries(TPipedTransportTest |
| 186 | ${Boost_LIBRARIES} |
| 187 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 188 | LINK_AGAINST_THRIFT_LIBRARY(TPipedTransportTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 189 | add_test(NAME TPipedTransportTest COMMAND TPipedTransportTest) |
| 190 | |
| 191 | set(AllProtocolsTest_SOURCES |
| 192 | AllProtocolTests.cpp |
| 193 | AllProtocolTests.tcc |
| 194 | GenericHelpers |
| 195 | ) |
| 196 | |
| 197 | add_executable(AllProtocolsTest ${AllProtocolsTest_SOURCES}) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 198 | target_link_libraries(AllProtocolsTest |
| 199 | testgencpp |
| 200 | ${Boost_LIBRARIES} |
| 201 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 202 | LINK_AGAINST_THRIFT_LIBRARY(AllProtocolsTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 203 | add_test(NAME AllProtocolsTest COMMAND AllProtocolsTest) |
| 204 | |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 205 | # The debug run-time in Windows asserts on isprint() with negative inputs |
| 206 | if (NOT MSVC OR (MSVC AND CMAKE_BUILD_TYPE EQUAL "DEBUG")) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 207 | add_executable(DebugProtoTest DebugProtoTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 208 | target_link_libraries(DebugProtoTest |
| 209 | testgencpp |
| 210 | ${Boost_LIBRARIES} |
| 211 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 212 | LINK_AGAINST_THRIFT_LIBRARY(DebugProtoTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 213 | add_test(NAME DebugProtoTest COMMAND DebugProtoTest) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 214 | endif() |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 215 | |
| 216 | add_executable(JSONProtoTest JSONProtoTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 217 | target_link_libraries(JSONProtoTest |
| 218 | testgencpp |
| 219 | ${Boost_LIBRARIES} |
| 220 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 221 | LINK_AGAINST_THRIFT_LIBRARY(JSONProtoTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 222 | add_test(NAME JSONProtoTest COMMAND JSONProtoTest) |
| 223 | |
| 224 | add_executable(OptionalRequiredTest OptionalRequiredTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 225 | target_link_libraries(OptionalRequiredTest |
| 226 | testgencpp |
| 227 | ${Boost_LIBRARIES} |
| 228 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 229 | LINK_AGAINST_THRIFT_LIBRARY(OptionalRequiredTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 230 | add_test(NAME OptionalRequiredTest COMMAND OptionalRequiredTest) |
| 231 | |
| 232 | add_executable(RecursiveTest RecursiveTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 233 | target_link_libraries(RecursiveTest |
| 234 | testgencpp |
| 235 | ${Boost_LIBRARIES} |
| 236 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 237 | LINK_AGAINST_THRIFT_LIBRARY(RecursiveTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 238 | add_test(NAME RecursiveTest COMMAND RecursiveTest) |
| 239 | |
| 240 | add_executable(SpecializationTest SpecializationTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 241 | target_link_libraries(SpecializationTest |
| 242 | testgencpp |
| 243 | ${Boost_LIBRARIES} |
| 244 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 245 | LINK_AGAINST_THRIFT_LIBRARY(SpecializationTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 246 | add_test(NAME SpecializationTest COMMAND SpecializationTest) |
| 247 | |
| 248 | set(concurrency_test_SOURCES |
| 249 | concurrency/Tests.cpp |
| 250 | concurrency/ThreadFactoryTests.h |
| 251 | concurrency/ThreadManagerTests.h |
| 252 | concurrency/TimerManagerTests.h |
| 253 | ) |
| 254 | add_executable(concurrency_test ${concurrency_test_SOURCES}) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 255 | LINK_AGAINST_THRIFT_LIBRARY(concurrency_test thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 256 | add_test(NAME concurrency_test COMMAND concurrency_test) |
| 257 | |
| 258 | set(link_test_SOURCES |
| 259 | link/LinkTest.cpp |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 260 | gen-cpp/ParentService.h |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 261 | link/TemplatedService1.cpp |
| 262 | link/TemplatedService2.cpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 263 | ) |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 264 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 265 | add_executable(link_test ${link_test_SOURCES}) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 266 | target_link_libraries(link_test testgencpp_cob) |
| 267 | LINK_AGAINST_THRIFT_LIBRARY(link_test thrift) |
Nobuaki Sukegawa | e8c71d8 | 2015-11-23 19:51:37 +0900 | [diff] [blame] | 268 | target_link_libraries(link_test testgencpp) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 269 | add_test(NAME link_test COMMAND link_test) |
| 270 | |
| 271 | if(WITH_LIBEVENT) |
| 272 | set(processor_test_SOURCES |
| 273 | processor/ProcessorTest.cpp |
| 274 | processor/EventLog.cpp |
| 275 | processor/ServerThread.cpp |
| 276 | processor/EventLog.h |
| 277 | processor/Handlers.h |
| 278 | processor/ServerThread.h |
| 279 | ) |
| 280 | add_executable(processor_test ${processor_test_SOURCES}) |
| 281 | target_link_libraries(processor_test |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 282 | testgencpp_cob |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 283 | ${Boost_LIBRARIES} |
| 284 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 285 | LINK_AGAINST_THRIFT_LIBRARY(processor_test thrift) |
| 286 | LINK_AGAINST_THRIFT_LIBRARY(processor_test thriftnb) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 287 | add_test(NAME processor_test COMMAND processor_test) |
Nobuaki Sukegawa | 8016af8 | 2015-01-02 23:14:22 +0900 | [diff] [blame] | 288 | |
| 289 | set(TNonblockingServerTest_SOURCES TNonblockingServerTest.cpp) |
| 290 | add_executable(TNonblockingServerTest ${TNonblockingServerTest_SOURCES}) |
| 291 | include_directories(${LIBEVENT_INCLUDE_DIRS}) |
| 292 | target_link_libraries(TNonblockingServerTest |
| 293 | testgencpp_cob |
Nobuaki Sukegawa | 8016af8 | 2015-01-02 23:14:22 +0900 | [diff] [blame] | 294 | ${LIBEVENT_LIBRARIES} |
| 295 | ${Boost_LIBRARIES} |
| 296 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 297 | LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thrift) |
| 298 | LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thriftnb) |
Nobuaki Sukegawa | 8016af8 | 2015-01-02 23:14:22 +0900 | [diff] [blame] | 299 | add_test(NAME TNonblockingServerTest COMMAND TNonblockingServerTest) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 300 | endif() |
| 301 | |
| 302 | if(OPENSSL_FOUND AND WITH_OPENSSL) |
| 303 | add_executable(OpenSSLManualInitTest OpenSSLManualInitTest.cpp) |
| 304 | target_link_libraries(OpenSSLManualInitTest |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 305 | ${OPENSSL_LIBRARIES} |
| 306 | ${Boost_LIBRARIES} |
| 307 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 308 | LINK_AGAINST_THRIFT_LIBRARY(OpenSSLManualInitTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 309 | add_test(NAME OpenSSLManualInitTest COMMAND OpenSSLManualInitTest) |
Sergei Nikulov | 34e0bb6 | 2015-09-02 13:06:22 +0300 | [diff] [blame] | 310 | |
| 311 | add_executable(SecurityTest SecurityTest.cpp) |
| 312 | target_link_libraries(SecurityTest |
| 313 | testgencpp |
| 314 | ${Boost_LIBRARIES} |
| 315 | ) |
| 316 | LINK_AGAINST_THRIFT_LIBRARY(SecurityTest thrift) |
Antonio Di Monaco | 796667b | 2016-01-04 23:05:19 +0100 | [diff] [blame] | 317 | if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT MINGW) |
Sergei Nikulov | 34e0bb6 | 2015-09-02 13:06:22 +0300 | [diff] [blame] | 318 | target_link_libraries(SecurityTest -lrt) |
| 319 | endif () |
James E. King, III | 07f5997 | 2017-03-10 06:18:33 -0500 | [diff] [blame^] | 320 | add_test(NAME SecurityTest COMMAND SecurityTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys") |
Sergei Nikulov | 34e0bb6 | 2015-09-02 13:06:22 +0300 | [diff] [blame] | 321 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 322 | endif() |
| 323 | |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 324 | if(WITH_QT4) |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 325 | set(CMAKE_AUTOMOC ON) |
| 326 | find_package(Qt4 REQUIRED COMPONENTS QtTest) |
| 327 | set(TQTcpServerTest_SOURCES |
| 328 | qt/TQTcpServerTest.cpp |
| 329 | ) |
| 330 | add_executable(TQTcpServerTest ${TQTcpServerTest_SOURCES}) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 331 | target_link_libraries(TQTcpServerTest testgencpp_cob thriftqt Qt4::QtTest) |
| 332 | LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest thrift) |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 333 | add_test(NAME TQTcpServerTest COMMAND TQTcpServerTest) |
| 334 | endif() |
| 335 | |
Nobuaki Sukegawa | 6622877 | 2014-12-07 21:45:33 +0900 | [diff] [blame] | 336 | if(WITH_QT5) |
| 337 | add_subdirectory(qt) |
| 338 | endif() |
| 339 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 340 | # |
| 341 | # Common thrift code generation rules |
| 342 | # |
| 343 | |
James E. King, III | b4c190b | 2017-02-13 16:39:59 -0500 | [diff] [blame] | 344 | add_custom_command(OUTPUT gen-cpp/AnnotationTest_constants.cpp |
| 345 | gen-cpp/AnnotationTest_constants.h |
| 346 | gen-cpp/AnnotationTest_types.cpp |
| 347 | gen-cpp/AnnotationTest_types.h |
| 348 | gen-cpp/foo_service.cpp |
| 349 | gen-cpp/foo_service.h |
| 350 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/AnnotationTest.thrift |
| 351 | ) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 352 | |
James E. King, III | b4c190b | 2017-02-13 16:39:59 -0500 | [diff] [blame] | 353 | add_custom_command(OUTPUT gen-cpp/DebugProtoTest_types.cpp gen-cpp/DebugProtoTest_types.h gen-cpp/EmptyService.cpp gen-cpp/EmptyService.h |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 354 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/DebugProtoTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 355 | ) |
| 356 | |
| 357 | add_custom_command(OUTPUT gen-cpp/EnumTest_types.cpp gen-cpp/EnumTest_types.h |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 358 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/EnumTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 359 | ) |
| 360 | |
| 361 | add_custom_command(OUTPUT gen-cpp/TypedefTest_types.cpp gen-cpp/TypedefTest_types.h |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 362 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/TypedefTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 363 | ) |
| 364 | |
| 365 | add_custom_command(OUTPUT gen-cpp/OptionalRequiredTest_types.cpp gen-cpp/OptionalRequiredTest_types.h |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 366 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/OptionalRequiredTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 367 | ) |
| 368 | |
| 369 | add_custom_command(OUTPUT gen-cpp/Recursive_types.cpp gen-cpp/Recursive_types.h |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 370 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/Recursive.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 371 | ) |
| 372 | |
| 373 | add_custom_command(OUTPUT gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 374 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/StressTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 375 | ) |
| 376 | |
| 377 | add_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 |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 378 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 379 | ) |
| 380 | |
| 381 | add_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 Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 382 | COMMAND ${THRIFT_COMPILER} --gen cpp:templates,cob_style ${CMAKE_CURRENT_SOURCE_DIR}/processor/proc.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 383 | ) |