blob: c6d8fc320381056e8921dcedc7e28a5b02a8d145 [file] [log] [blame]
Ben Craig74086f12015-07-04 17:18:58 -05001#
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 IIIc9ac8d22019-01-07 16:46:45 -050020include(BoostMacros)
21REQUIRE_BOOST_HEADERS()
Ben Craig74086f12015-07-04 17:18:58 -050022
23#Make sure gen-cpp files can be included
24include_directories("${CMAKE_CURRENT_BINARY_DIR}")
25include_directories("${CMAKE_CURRENT_BINARY_DIR}/gen-cpp")
26include_directories("${PROJECT_SOURCE_DIR}/lib/cpp/src")
27
28include(ThriftMacros)
29
Nobuaki Sukegawa11da87e2016-09-10 14:02:19 +090030set(tutorialgencpp_SOURCES
Ben Craig74086f12015-07-04 17:18:58 -050031 gen-cpp/Calculator.cpp
32 gen-cpp/SharedService.cpp
33 gen-cpp/shared_constants.cpp
34 gen-cpp/shared_types.cpp
35 gen-cpp/tutorial_constants.cpp
36 gen-cpp/tutorial_types.cpp
37)
38add_library(tutorialgencpp STATIC ${tutorialgencpp_SOURCES})
39LINK_AGAINST_THRIFT_LIBRARY(tutorialgencpp thrift)
40
41add_custom_command(OUTPUT gen-cpp/Calculator.cpp gen-cpp/SharedService.cpp gen-cpp/shared_constants.cpp gen-cpp/shared_types.cpp gen-cpp/tutorial_constants.cpp gen-cpp/tutorial_types.cpp
Nobuaki Sukegawaca939362015-11-14 00:23:40 +090042 COMMAND ${THRIFT_COMPILER} --gen cpp -r ${PROJECT_SOURCE_DIR}/tutorial/tutorial.thrift
Ben Craig74086f12015-07-04 17:18:58 -050043)
44
45add_executable(TutorialServer CppServer.cpp)
46target_link_libraries(TutorialServer tutorialgencpp)
47LINK_AGAINST_THRIFT_LIBRARY(TutorialServer thrift)
James E. King, III7edc8fa2017-01-20 10:11:41 -050048if (ZLIB_FOUND)
49 target_link_libraries(TutorialServer ${ZLIB_LIBRARIES})
50endif ()
Ben Craig74086f12015-07-04 17:18:58 -050051
52add_executable(TutorialClient CppClient.cpp)
53target_link_libraries(TutorialClient tutorialgencpp)
54LINK_AGAINST_THRIFT_LIBRARY(TutorialClient thrift)
James E. King, III7edc8fa2017-01-20 10:11:41 -050055if (ZLIB_FOUND)
56 target_link_libraries(TutorialClient ${ZLIB_LIBRARIES})
57endif ()