James E. King III | c9ac8d2 | 2019-01-07 16:46:45 -0500 | [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 | |
James E. King III | ee8caca | 2019-05-04 08:20:59 -0400 | [diff] [blame] | 20 | set(BOOST_MINREV 1.56) |
James E. King III | c9ac8d2 | 2019-01-07 16:46:45 -0500 | [diff] [blame] | 21 | |
James E. King III | 9ecdce3 | 2019-05-03 11:24:55 -0400 | [diff] [blame] | 22 | # we are not ready for the new style link targets introduced in |
| 23 | # boost 1.70.0 and cmake 3.14.2 which showed up on appveyor in |
| 24 | # mingw builds |
| 25 | set(Boost_NO_BOOST_CMAKE ON) |
| 26 | |
James E. King III | c9ac8d2 | 2019-01-07 16:46:45 -0500 | [diff] [blame] | 27 | macro(REQUIRE_BOOST_HEADERS) |
| 28 | find_package(Boost ${BOOST_MINREV} QUIET REQUIRED) |
| 29 | if (NOT Boost_FOUND) |
| 30 | string(CONCAT fatal_message |
James E. King III | 9ecdce3 | 2019-05-03 11:24:55 -0400 | [diff] [blame] | 31 | "Boost ${BOOST_MINREV} or later is required to build sources in ${CMAKE_CURRENT_SOURCE_DIR}") |
James E. King III | c9ac8d2 | 2019-01-07 16:46:45 -0500 | [diff] [blame] | 32 | message(FATAL_ERROR, ${fatal_message}) |
| 33 | endif() |
James E. King III | 9ecdce3 | 2019-05-03 11:24:55 -0400 | [diff] [blame] | 34 | if (DEFINED Boost_INCLUDE_DIRS) |
| 35 | # pre-boost 1.70.0 aware cmake, otherwise it is using targets |
| 36 | include_directories(SYSTEM "${Boost_INCLUDE_DIRS}") |
| 37 | endif() |
James E. King III | c9ac8d2 | 2019-01-07 16:46:45 -0500 | [diff] [blame] | 38 | endmacro() |
| 39 | |
| 40 | macro(REQUIRE_BOOST_LIBRARIES libs) |
| 41 | message(STATUS "Locating boost libraries required by sources in ${CMAKE_CURRENT_SOURCE_DIR}") |
| 42 | find_package(Boost ${BOOST_MINREV} REQUIRED COMPONENTS ${${libs}}) |
| 43 | if (NOT Boost_FOUND) |
| 44 | string(CONCAT fatal_message |
James E. King III | 9ecdce3 | 2019-05-03 11:24:55 -0400 | [diff] [blame] | 45 | "Boost ${BOOST_MINREV} or later is required to build sources in ${CMAKE_CURRENT_SOURCE_DIR}, " |
James E. King III | c9ac8d2 | 2019-01-07 16:46:45 -0500 | [diff] [blame] | 46 | "or use -DBUILD_TESTING=OFF") |
| 47 | message(FATAL_ERROR, ${fatal_message}) |
| 48 | endif() |
| 49 | endmacro() |