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 | include(CMakeDependentOption) |
| 22 | |
| 23 | # Additional components |
| 24 | option(BUILD_COMPILER "Build Thrift compiler" ON) |
| 25 | option(BUILD_TESTING "Build with unit tests" ON) |
| 26 | option(BUILD_EXAMPLES "Build examples" ON) |
| 27 | option(BUILD_LIBRARIES "Build Thrfit libraries" ON) |
| 28 | |
| 29 | # Libraries to build |
| 30 | |
| 31 | # Each language library can be enabled or disabled using the WITH_<LANG> flag. |
| 32 | # By default CMake checks if the required dependencies for a language are present |
| 33 | # and enables the library if all are found. This means the default is to build as |
| 34 | # much as possible but leaving out libraries if their dependencies are not met. |
| 35 | |
| 36 | # C++ |
| 37 | find_package(Boost 1.53 QUIET) |
| 38 | CMAKE_DEPENDENT_OPTION(WITH_CPP "Build C++ library" ON |
| 39 | "BUILD_LIBRARIES;Boost_FOUND" OFF) |
| 40 | # NOTE: Currently the following options are C++ specific, |
| 41 | # but in future other libraries might reuse them. |
| 42 | # So they are not dependent on WIHT_CPP but setting them without WITH_CPP currently |
| 43 | # has no effect. |
| 44 | find_package(ZLIB QUIET) |
| 45 | CMAKE_DEPENDENT_OPTION(WITH_ZLIB "Build with ZLIB support" ON |
| 46 | "ZLIB_FOUND" OFF) |
| 47 | find_package(Libevent QUIET) |
| 48 | CMAKE_DEPENDENT_OPTION(WITH_LIBEVENT "Build with libevent support" ON |
| 49 | "Libevent_FOUND" OFF) |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame^] | 50 | find_package(Qt4 QUIET COMPONENTS QtCore QtNetwork) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 51 | CMAKE_DEPENDENT_OPTION(WITH_QT4 "Build with Qt4 support" ON |
| 52 | "QT4_FOUND" OFF) |
| 53 | find_package(OpenSSL QUIET) |
| 54 | CMAKE_DEPENDENT_OPTION(WITH_OPENSSL "Build with OpenSSL support" ON |
| 55 | "OpenSSL_FOUND" OFF) |
| 56 | option(WITH_BOOSTTHREADS "Build with Boost thread support" OFF) |
| 57 | option(WITH_STDTHREADS "Build with C++ std::thread support" OFF) |
| 58 | |
| 59 | # C GLib |
| 60 | find_package(GLIB QUIET COMPONENTS gobject) |
| 61 | CMAKE_DEPENDENT_OPTION(WITH_C_GLIB "Build C (GLib) library" ON |
| 62 | "BUILD_LIBRARIES;GLIB_FOUND" OFF) |
| 63 | # Java |
| 64 | find_package(Java QUIET) |
| 65 | CMAKE_DEPENDENT_OPTION(WITH_JAVA "Build Java library" ON |
| 66 | "BUILD_LIBRARIES;JAVA_FOUND" OFF) |
| 67 | |
| 68 | # Common library options |
| 69 | option(WITH_SHARED_LIB "Build shared libraries" ON) |
| 70 | option(WITH_STATIC_LIB "Build static libraries" ON) |
| 71 | |
| 72 | #NOTE: C++ compiler options are defined in the lib/cpp/CMakeLists.txt |
| 73 | |
| 74 | # Visual Studio only options |
| 75 | if(MSVC) |
| 76 | option(WITH_MT "Build unsing MT instead of MT (MSVC only)" OFF) |
| 77 | endif(MSVC) |
| 78 | |
| 79 | macro(PRINT_CONFIG_SUMMARY) |
| 80 | message(STATUS "----------------------------------------------------------") |
| 81 | message(STATUS "Thrift version: ${thrift_VERSION} (${thrift_VERSION_MAJOR}.${thrift_VERSION_MINOR}.${thrift_VERSION_PATCH})") |
| 82 | message(STATUS "Thrift package version: ${PACKAGE_VERSION}") |
| 83 | message(STATUS "Build configuration Summary") |
| 84 | message(STATUS " Build Thrift compiler: ${BUILD_COMPILER}") |
| 85 | message(STATUS " Build with unit tests: ${BUILD_TESTING}") |
| 86 | message(STATUS " Build examples: ${BUILD_EXAMPLES}") |
| 87 | message(STATUS " Build Thrfit libraries: ${BUILD_LIBRARIES}") |
| 88 | message(STATUS " Language libraries:") |
| 89 | message(STATUS " Build C++ library: ${WITH_CPP}") |
| 90 | message(STATUS " Build C (GLib) library: ${WITH_C_GLIB}") |
| 91 | message(STATUS " Build Java library: ${WITH_JAVA}") |
| 92 | message(STATUS " Library features:") |
| 93 | message(STATUS " Build shared libraries: ${WITH_SHARED_LIB}") |
| 94 | message(STATUS " Build static libraries: ${WITH_STATIC_LIB}") |
| 95 | message(STATUS " Build with ZLIB support: ${WITH_ZLIB}") |
| 96 | message(STATUS " Build with libevent support: ${WITH_LIBEVENT}") |
| 97 | message(STATUS " Build with Qt4 support: ${WITH_QT4}") |
| 98 | message(STATUS " Build with OpenSSL support: ${WITH_OPENSSL}") |
| 99 | message(STATUS " Build with Boost thread support: ${WITH_BOOSTTHREADS}") |
| 100 | message(STATUS " Build with C++ std::thread support: ${WITH_STDTHREADS}") |
| 101 | message(STATUS "----------------------------------------------------------") |
| 102 | endmacro(PRINT_CONFIG_SUMMARY) |