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