Files
mp11/CMakeLists.txt

69 lines
1.8 KiB
CMake
Raw Normal View History

2019-12-21 16:28:12 +02:00
# Copyright 2018, 2019 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.16)
2020-12-14 03:34:16 +02:00
project(boost_mp11 VERSION 1.76.0 LANGUAGES CXX)
add_library(boost_mp11 INTERFACE)
add_library(Boost::mp11 ALIAS boost_mp11)
2019-12-27 03:50:12 +02:00
target_include_directories(boost_mp11 INTERFACE include)
target_compile_features(boost_mp11 INTERFACE cxx_alias_templates cxx_variadic_templates cxx_decltype)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
2019-12-27 03:50:12 +02:00
# Fetch support files
2019-12-27 03:50:12 +02:00
message(STATUS "Fetching BoostFetch.cmake")
2019-12-27 03:50:12 +02:00
file(DOWNLOAD
"https://raw.githubusercontent.com/boostorg/cmake/develop/include/BoostFetch.cmake"
"${CMAKE_BINARY_DIR}/fetch_and_include/BoostFetch.cmake"
)
2019-12-27 03:50:12 +02:00
include("${CMAKE_BINARY_DIR}/fetch_and_include/BoostFetch.cmake")
2019-12-27 03:50:12 +02:00
boost_fetch(boostorg/cmake TAG develop NO_ADD_SUBDIR)
2019-12-27 03:50:12 +02:00
FetchContent_GetProperties(boostorg_cmake)
2019-12-27 03:50:12 +02:00
list(APPEND CMAKE_MODULE_PATH ${boostorg_cmake_SOURCE_DIR}/include)
2019-12-27 03:50:12 +02:00
# Enable testing
2019-12-27 03:50:12 +02:00
include(CTest)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
2019-12-27 03:50:12 +02:00
if(BUILD_TESTING)
2019-12-27 03:50:12 +02:00
set(BUILD_TESTING OFF) # hide cache variable
2019-12-27 03:50:12 +02:00
boost_fetch(boostorg/assert TAG develop EXCLUDE_FROM_ALL)
boost_fetch(boostorg/config TAG develop EXCLUDE_FROM_ALL)
boost_fetch(boostorg/core TAG develop EXCLUDE_FROM_ALL)
2019-12-27 03:50:12 +02:00
unset(BUILD_TESTING)
2019-12-27 03:50:12 +02:00
endif()
# Do not use the default BoostInstall versioned layout on Windows when standalone
set(BOOST_INSTALL_LAYOUT "system" CACHE STRING "Installation layout (versioned, tagged, or system)")
endif()
include(BoostInstall OPTIONAL RESULT_VARIABLE HAVE_BOOST_INSTALL)
if(HAVE_BOOST_INSTALL)
2019-12-27 03:50:12 +02:00
boost_install(TARGETS boost_mp11 HEADER_DIRECTORY include/)
endif()
if(BUILD_TESTING)
2019-12-27 03:50:12 +02:00
add_subdirectory(test)
endif()