Ben Craig | 74086f1 | 2015-07-04 17:18:58 -0500 | [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 | |
James E. King III | c9ac8d2 | 2019-01-07 16:46:45 -0500 | [diff] [blame] | 20 | include(BoostMacros) |
| 21 | REQUIRE_BOOST_HEADERS() |
Ben Craig | 74086f1 | 2015-07-04 17:18:58 -0500 | [diff] [blame] | 22 | |
| 23 | #Make sure gen-cpp files can be included |
| 24 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
| 25 | include_directories("${CMAKE_CURRENT_BINARY_DIR}/gen-cpp") |
| 26 | include_directories("${PROJECT_SOURCE_DIR}/lib/cpp/src") |
| 27 | |
| 28 | include(ThriftMacros) |
| 29 | |
Nobuaki Sukegawa | 11da87e | 2016-09-10 14:02:19 +0900 | [diff] [blame] | 30 | set(tutorialgencpp_SOURCES |
Ben Craig | 74086f1 | 2015-07-04 17:18:58 -0500 | [diff] [blame] | 31 | gen-cpp/Calculator.cpp |
| 32 | gen-cpp/SharedService.cpp |
Ben Craig | 74086f1 | 2015-07-04 17:18:58 -0500 | [diff] [blame] | 33 | gen-cpp/shared_types.cpp |
| 34 | gen-cpp/tutorial_constants.cpp |
| 35 | gen-cpp/tutorial_types.cpp |
| 36 | ) |
| 37 | add_library(tutorialgencpp STATIC ${tutorialgencpp_SOURCES}) |
Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 38 | target_link_libraries(tutorialgencpp thrift) |
Ben Craig | 74086f1 | 2015-07-04 17:18:58 -0500 | [diff] [blame] | 39 | |
zeshuai007 | 57c2507 | 2020-04-09 11:17:05 +0800 | [diff] [blame] | 40 | add_custom_command(OUTPUT gen-cpp/Calculator.cpp gen-cpp/SharedService.cpp gen-cpp/shared_types.cpp gen-cpp/tutorial_constants.cpp gen-cpp/tutorial_types.cpp |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 41 | COMMAND ${THRIFT_COMPILER} --gen cpp -r ${PROJECT_SOURCE_DIR}/tutorial/tutorial.thrift |
Ben Craig | 74086f1 | 2015-07-04 17:18:58 -0500 | [diff] [blame] | 42 | ) |
| 43 | |
| 44 | add_executable(TutorialServer CppServer.cpp) |
| 45 | target_link_libraries(TutorialServer tutorialgencpp) |
Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 46 | target_link_libraries(TutorialServer thrift) |
James E. King, III | 7edc8fa | 2017-01-20 10:11:41 -0500 | [diff] [blame] | 47 | if (ZLIB_FOUND) |
| 48 | target_link_libraries(TutorialServer ${ZLIB_LIBRARIES}) |
| 49 | endif () |
Ben Craig | 74086f1 | 2015-07-04 17:18:58 -0500 | [diff] [blame] | 50 | |
| 51 | add_executable(TutorialClient CppClient.cpp) |
| 52 | target_link_libraries(TutorialClient tutorialgencpp) |
Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 53 | target_link_libraries(TutorialClient thrift) |
James E. King, III | 7edc8fa | 2017-01-20 10:11:41 -0500 | [diff] [blame] | 54 | if (ZLIB_FOUND) |
| 55 | target_link_libraries(TutorialClient ${ZLIB_LIBRARIES}) |
| 56 | endif () |