cloudflare/ClickHouse
Publicmirrored fromhttps://github.com/cloudflare/ClickHouse
cmake/find/boost.cmake
51lines · modecode
6 years ago
| 1 | option (USE_INTERNAL_BOOST_LIBRARY "Set to FALSE to use system boost library instead of bundled" ${NOT_UNBUNDLED}) |
| 2 | |
| 3 | # Test random file existing in all package variants |
| 4 | if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/boost/libs/system/src/error_code.cpp") |
| 5 | if(USE_INTERNAL_BOOST_LIBRARY) |
| 6 | message(WARNING "submodules in contrib/boost is missing. to fix try run: \n git submodule update --init --recursive") |
| 7 | endif() |
| 8 | set (USE_INTERNAL_BOOST_LIBRARY 0) |
| 9 | set (MISSING_INTERNAL_BOOST_LIBRARY 1) |
| 10 | endif () |
| 11 | |
| 12 | if (NOT USE_INTERNAL_BOOST_LIBRARY) |
| 13 | set (Boost_USE_STATIC_LIBS ${USE_STATIC_LIBRARIES}) |
| 14 | set (BOOST_ROOT "/usr/local") |
| 15 | find_package (Boost 1.60 COMPONENTS program_options system filesystem thread regex) |
| 16 | # incomplete, no include search, who use it? |
| 17 | if (NOT Boost_FOUND) |
| 18 | # # Try to find manually. |
| 19 | # set (BOOST_PATHS "") |
| 20 | # find_library (Boost_PROGRAM_OPTIONS_LIBRARY boost_program_options PATHS ${BOOST_PATHS}) |
| 21 | # find_library (Boost_SYSTEM_LIBRARY boost_system PATHS ${BOOST_PATHS}) |
| 22 | # find_library (Boost_FILESYSTEM_LIBRARY boost_filesystem PATHS ${BOOST_PATHS}) |
| 23 | # maybe found but incorrect version. |
| 24 | set (Boost_INCLUDE_DIRS "") |
| 25 | set (Boost_SYSTEM_LIBRARY "") |
| 26 | endif () |
| 27 | endif () |
| 28 | |
| 29 | if (NOT Boost_SYSTEM_LIBRARY AND NOT MISSING_INTERNAL_BOOST_LIBRARY) |
| 30 | set (USE_INTERNAL_BOOST_LIBRARY 1) |
| 31 | set (Boost_SYSTEM_LIBRARY boost_system_internal) |
| 32 | set (Boost_PROGRAM_OPTIONS_LIBRARY boost_program_options_internal) |
| 33 | set (Boost_FILESYSTEM_LIBRARY boost_filesystem_internal ${Boost_SYSTEM_LIBRARY}) |
| 34 | set (Boost_REGEX_LIBRARY boost_regex_internal) |
| 35 | |
| 36 | set (Boost_INCLUDE_DIRS) |
| 37 | |
| 38 | set (BOOST_ROOT "${ClickHouse_SOURCE_DIR}/contrib/boost") |
| 39 | |
| 40 | # For boost from github: |
| 41 | file (GLOB Boost_INCLUDE_DIRS_ "${ClickHouse_SOURCE_DIR}/contrib/boost/libs/*/include") |
| 42 | list (APPEND Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIRS_}) |
| 43 | # numeric has additional level |
| 44 | file (GLOB Boost_INCLUDE_DIRS_ "${ClickHouse_SOURCE_DIR}/contrib/boost/libs/numeric/*/include") |
| 45 | list (APPEND Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIRS_}) |
| 46 | |
| 47 | # For packaged version: |
| 48 | list (APPEND Boost_INCLUDE_DIRS "${ClickHouse_SOURCE_DIR}/contrib/boost") |
| 49 | endif () |
| 50 | |
| 51 | message (STATUS "Using Boost: ${Boost_INCLUDE_DIRS} : ${Boost_PROGRAM_OPTIONS_LIBRARY},${Boost_SYSTEM_LIBRARY},${Boost_FILESYSTEM_LIBRARY},${Boost_REGEX_LIBRARY}") |