]> git.proxmox.com Git - ceph.git/blob - ceph/src/arrow/cpp/cmake_modules/FindBoostAlt.cmake
import quincy 17.2.0
[ceph.git] / ceph / src / arrow / cpp / cmake_modules / FindBoostAlt.cmake
1 # Licensed to the Apache Software Foundation (ASF) under one
2 # or more contributor license agreements. See the NOTICE file
3 # distributed with this work for additional information
4 # regarding copyright ownership. The ASF licenses this file
5 # to you under the Apache License, Version 2.0 (the
6 # "License"); you may not use this file except in compliance
7 # with the License. You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing,
12 # software distributed under the License is distributed on an
13 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 # KIND, either express or implied. See the License for the
15 # specific language governing permissions and limitations
16 # under the License.
17
18 if(DEFINED ENV{BOOST_ROOT} OR DEFINED BOOST_ROOT)
19 # In older versions of CMake (such as 3.2), the system paths for Boost will
20 # be looked in first even if we set $BOOST_ROOT or pass -DBOOST_ROOT
21 set(Boost_NO_SYSTEM_PATHS ON)
22 endif()
23
24 set(BoostAlt_FIND_VERSION_OPTIONS)
25 if(BoostAlt_FIND_VERSION)
26 list(APPEND BoostAlt_FIND_VERSION_OPTIONS ${BoostAlt_FIND_VERSION})
27 endif()
28 if(BoostAlt_FIND_REQUIRED)
29 list(APPEND BoostAlt_FIND_VERSION_OPTIONS REQUIRED)
30 endif()
31 if(BoostAlt_FIND_QUIETLY)
32 list(APPEND BoostAlt_FIND_VERSION_OPTIONS QUIET)
33 endif()
34
35 if(ARROW_BOOST_USE_SHARED)
36 # Find shared Boost libraries.
37 set(Boost_USE_STATIC_LIBS OFF)
38 set(BUILD_SHARED_LIBS_KEEP ${BUILD_SHARED_LIBS})
39 set(BUILD_SHARED_LIBS ON)
40
41 find_package(Boost ${BoostAlt_FIND_VERSION_OPTIONS} COMPONENTS system filesystem)
42 set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_KEEP})
43 unset(BUILD_SHARED_LIBS_KEEP)
44 else()
45 # Find static boost headers and libs
46 # TODO Differentiate here between release and debug builds
47 set(Boost_USE_STATIC_LIBS ON)
48 find_package(Boost ${BoostAlt_FIND_VERSION_OPTIONS} COMPONENTS system filesystem)
49 endif()
50
51 if(Boost_FOUND)
52 set(BoostAlt_FOUND ON)
53 if(MSVC_TOOLCHAIN)
54 # disable autolinking in boost
55 add_definitions(-DBOOST_ALL_NO_LIB)
56 if(ARROW_BOOST_USE_SHARED)
57 # force all boost libraries to dynamic link
58 add_definitions(-DBOOST_ALL_DYN_LINK)
59 endif()
60 endif()
61 else()
62 set(BoostAlt_FOUND OFF)
63 endif()