]>
Commit | Line | Data |
---|---|---|
92f5a8d4 TL |
1 | # Copyright Peter Dimov, Hans Dembinski 2018-2019 |
2 | # Distributed under the Boost Software License, Version 1.0. | |
3 | # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt | |
4 | ||
f67539c2 TL |
5 | # We support CMake 3.5, but prefer 3.16 policies and behavior |
6 | cmake_minimum_required(VERSION 3.5...3.16) | |
92f5a8d4 | 7 | |
f67539c2 | 8 | project(boost_histogram VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) |
92f5a8d4 TL |
9 | |
10 | add_library(boost_histogram INTERFACE) | |
92f5a8d4 TL |
11 | add_library(Boost::histogram ALIAS boost_histogram) |
12 | ||
f67539c2 | 13 | target_include_directories(boost_histogram INTERFACE include) |
f67539c2 | 14 | target_compile_features(boost_histogram INTERFACE cxx_std_14) |
92f5a8d4 | 15 | target_link_libraries(boost_histogram |
f67539c2 | 16 | INTERFACE |
f67539c2 TL |
17 | Boost::config |
18 | Boost::core | |
19 | Boost::mp11 | |
20 | Boost::throw_exception | |
21 | Boost::variant2) | |
92f5a8d4 TL |
22 | |
23 | if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) | |
20effc67 | 24 | # Standalone build, fetch dependencies |
92f5a8d4 | 25 | |
f67539c2 TL |
26 | # Fetch support files |
27 | ||
28 | message(STATUS "Fetching BoostFetch.cmake") | |
29 | ||
30 | file(DOWNLOAD | |
31 | "https://raw.githubusercontent.com/boostorg/cmake/develop/include/BoostFetch.cmake" | |
20effc67 | 32 | "${CMAKE_BINARY_DIR}/BoostFetch.cmake" |
f67539c2 TL |
33 | ) |
34 | ||
20effc67 | 35 | include("${CMAKE_BINARY_DIR}/BoostFetch.cmake") |
f67539c2 TL |
36 | |
37 | boost_fetch(boostorg/cmake TAG develop NO_ADD_SUBDIR) | |
38 | ||
39 | FetchContent_GetProperties(boostorg_cmake) | |
40 | ||
41 | list(APPEND CMAKE_MODULE_PATH ${boostorg_cmake_SOURCE_DIR}/include) | |
42 | ||
43 | # Enable testing | |
44 | ||
45 | include(CTest) | |
46 | add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>) | |
47 | ||
48 | if(BUILD_TESTING) | |
49 | ||
20effc67 | 50 | set(BUILD_TESTING OFF) # do not build tests of dependencies |
f67539c2 | 51 | |
20effc67 | 52 | boost_fetch(boostorg/assert TAG develop EXCLUDE_FROM_ALL) # needed by core |
f67539c2 TL |
53 | boost_fetch(boostorg/config TAG develop EXCLUDE_FROM_ALL) |
54 | boost_fetch(boostorg/core TAG develop EXCLUDE_FROM_ALL) | |
55 | boost_fetch(boostorg/mp11 TAG develop EXCLUDE_FROM_ALL) | |
56 | boost_fetch(boostorg/throw_exception TAG develop EXCLUDE_FROM_ALL) | |
57 | boost_fetch(boostorg/variant2 TAG develop EXCLUDE_FROM_ALL) | |
58 | ## No cmake support yet | |
59 | # boost_fetch(boostorg/accumulators TAG develop) | |
60 | # boost_fetch(boostorg/range TAG develop) | |
61 | # boost_fetch(boostorg/serialization TAG develop) | |
62 | # boost_fetch(boostorg/units TAG develop) | |
63 | ||
20effc67 | 64 | set(BUILD_TESTING ON) |
f67539c2 TL |
65 | |
66 | endif() | |
92f5a8d4 TL |
67 | |
68 | endif() | |
69 | ||
f67539c2 TL |
70 | if (BUILD_TESTING) |
71 | ||
72 | add_subdirectory(test) | |
73 | ||
74 | # do not pollute the superproject with the benchmarks | |
75 | if(NOT BOOST_SUPERPROJECT_VERSION) | |
76 | ||
77 | add_subdirectory(benchmark) | |
78 | ||
79 | endif() | |
80 | ||
92f5a8d4 | 81 | endif() |