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