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 | |
| 20 | |
| 21 | cmake_minimum_required(VERSION 2.8) |
| 22 | |
| 23 | # Find required packages |
| 24 | find_package(GLIB REQUIRED COMPONENTS gobject) |
| 25 | include_directories(${GLIB_INCLUDE_DIRS}) |
| 26 | |
| 27 | include_directories(src) |
| 28 | |
| 29 | # SYSLIBS contains libraries that need to be linked to all lib targets |
| 30 | set(SYSLIBS ${GLIB_LIBRARIES} ${GLIB_GOBJECT_LIBRARIES}) |
| 31 | |
| 32 | # Create the thrift C glib library |
| 33 | set(thrift_c_glib_SOURCES |
| 34 | src/thrift/c_glib/thrift.c |
| 35 | src/thrift/c_glib/thrift_struct.c |
| 36 | src/thrift/c_glib/thrift_application_exception.c |
| 37 | src/thrift/c_glib/processor/thrift_processor.c |
| 38 | src/thrift/c_glib/processor/thrift_dispatch_processor.c |
| 39 | src/thrift/c_glib/protocol/thrift_protocol.c |
| 40 | src/thrift/c_glib/protocol/thrift_protocol_factory.c |
| 41 | src/thrift/c_glib/protocol/thrift_binary_protocol.c |
| 42 | src/thrift/c_glib/protocol/thrift_binary_protocol_factory.c |
| 43 | src/thrift/c_glib/transport/thrift_transport.c |
| 44 | src/thrift/c_glib/transport/thrift_transport_factory.c |
| 45 | src/thrift/c_glib/transport/thrift_buffered_transport_factory.c |
| 46 | src/thrift/c_glib/transport/thrift_framed_transport_factory.c |
| 47 | src/thrift/c_glib/transport/thrift_socket.c |
| 48 | src/thrift/c_glib/transport/thrift_server_transport.c |
| 49 | src/thrift/c_glib/transport/thrift_server_socket.c |
| 50 | src/thrift/c_glib/transport/thrift_buffered_transport.c |
| 51 | src/thrift/c_glib/transport/thrift_framed_transport.c |
| 52 | src/thrift/c_glib/transport/thrift_memory_buffer.c |
| 53 | src/thrift/c_glib/server/thrift_server.c |
| 54 | src/thrift/c_glib/server/thrift_simple_server.c |
| 55 | ) |
| 56 | |
| 57 | # Contains the thrift specific ADD_LIBRARY_THRIFT and TARGET_LINK_LIBRARIES_THRIFT |
| 58 | include(ThriftMacros) |
| 59 | |
| 60 | ADD_LIBRARY_THRIFT(thrift_c_glib ${thrift_c_glib_SOURCES}) |
| 61 | TARGET_LINK_LIBRARIES_THRIFT(thrift_c_glib ${SYSLIBS}) |
| 62 | |
| 63 | # Install the headers |
| 64 | install(DIRECTORY "src/thrift" DESTINATION "${INCLUDE_INSTALL_DIR}" |
| 65 | FILES_MATCHING PATTERN "*.h") |
| 66 | |
| 67 | if(BUILD_TESTING) |
| 68 | add_subdirectory(test) |
| 69 | endif() |