blob: 6a3a85dc927150b772c9c9b29f3783715273a32c [file] [log] [blame]
Pascal Bachd5f87e12014-12-12 15:59:17 +01001#
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
21include(CMakeDependentOption)
22
23# Additional components
24option(BUILD_COMPILER "Build Thrift compiler" ON)
25option(BUILD_TESTING "Build with unit tests" ON)
26option(BUILD_EXAMPLES "Build examples" ON)
27option(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++
37find_package(Boost 1.53 QUIET)
38CMAKE_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.
44find_package(ZLIB QUIET)
45CMAKE_DEPENDENT_OPTION(WITH_ZLIB "Build with ZLIB support" ON
46 "ZLIB_FOUND" OFF)
47find_package(Libevent QUIET)
48CMAKE_DEPENDENT_OPTION(WITH_LIBEVENT "Build with libevent support" ON
49 "Libevent_FOUND" OFF)
50find_package(Qt4 QUIET)
51CMAKE_DEPENDENT_OPTION(WITH_QT4 "Build with Qt4 support" ON
52 "QT4_FOUND" OFF)
53find_package(OpenSSL QUIET)
54CMAKE_DEPENDENT_OPTION(WITH_OPENSSL "Build with OpenSSL support" ON
55 "OpenSSL_FOUND" OFF)
56option(WITH_BOOSTTHREADS "Build with Boost thread support" OFF)
57option(WITH_STDTHREADS "Build with C++ std::thread support" OFF)
58
59# C GLib
60find_package(GLIB QUIET COMPONENTS gobject)
61CMAKE_DEPENDENT_OPTION(WITH_C_GLIB "Build C (GLib) library" ON
62 "BUILD_LIBRARIES;GLIB_FOUND" OFF)
63# Java
64find_package(Java QUIET)
65CMAKE_DEPENDENT_OPTION(WITH_JAVA "Build Java library" ON
66 "BUILD_LIBRARIES;JAVA_FOUND" OFF)
67
68# Common library options
69option(WITH_SHARED_LIB "Build shared libraries" ON)
70option(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
75if(MSVC)
76option(WITH_MT "Build unsing MT instead of MT (MSVC only)" OFF)
77endif(MSVC)
78
79macro(PRINT_CONFIG_SUMMARY)
80message(STATUS "----------------------------------------------------------")
81message(STATUS "Thrift version: ${thrift_VERSION} (${thrift_VERSION_MAJOR}.${thrift_VERSION_MINOR}.${thrift_VERSION_PATCH})")
82message(STATUS "Thrift package version: ${PACKAGE_VERSION}")
83message(STATUS "Build configuration Summary")
84message(STATUS " Build Thrift compiler: ${BUILD_COMPILER}")
85message(STATUS " Build with unit tests: ${BUILD_TESTING}")
86message(STATUS " Build examples: ${BUILD_EXAMPLES}")
87message(STATUS " Build Thrfit libraries: ${BUILD_LIBRARIES}")
88message(STATUS " Language libraries:")
89message(STATUS " Build C++ library: ${WITH_CPP}")
90message(STATUS " Build C (GLib) library: ${WITH_C_GLIB}")
91message(STATUS " Build Java library: ${WITH_JAVA}")
92message(STATUS " Library features:")
93message(STATUS " Build shared libraries: ${WITH_SHARED_LIB}")
94message(STATUS " Build static libraries: ${WITH_STATIC_LIB}")
95message(STATUS " Build with ZLIB support: ${WITH_ZLIB}")
96message(STATUS " Build with libevent support: ${WITH_LIBEVENT}")
97message(STATUS " Build with Qt4 support: ${WITH_QT4}")
98message(STATUS " Build with OpenSSL support: ${WITH_OPENSSL}")
99message(STATUS " Build with Boost thread support: ${WITH_BOOSTTHREADS}")
100message(STATUS " Build with C++ std::thread support: ${WITH_STDTHREADS}")
101message(STATUS "----------------------------------------------------------")
102endmacro(PRINT_CONFIG_SUMMARY)