2018-09-28 17:55:52 +03:00
|
|
|
# Copyright 2018 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)
|
|
|
|
|
|
|
|
|
|
project(BoostMp11 VERSION 1.69.0 LANGUAGES CXX)
|
|
|
|
|
|
|
|
|
|
add_library(boost_mp11 INTERFACE)
|
2018-09-30 21:49:46 +03:00
|
|
|
set_property(TARGET boost_mp11 PROPERTY EXPORT_NAME mp11)
|
|
|
|
|
|
2018-09-28 17:55:52 +03:00
|
|
|
add_library(Boost::mp11 ALIAS boost_mp11)
|
|
|
|
|
|
2018-09-30 21:49:46 +03:00
|
|
|
target_include_directories(boost_mp11 INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
|
2018-09-29 00:15:53 +03:00
|
|
|
target_compile_features(boost_mp11 INTERFACE cxx_alias_templates cxx_variadic_templates cxx_decltype)
|
2018-09-28 17:55:52 +03:00
|
|
|
|
|
|
|
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|
|
|
|
|
2018-09-30 21:49:46 +03:00
|
|
|
# --target check
|
|
|
|
|
|
2018-09-28 17:55:52 +03:00
|
|
|
# requires CMake 3.11 so we just carry it around
|
|
|
|
|
include(cmake/FetchContent.cmake)
|
|
|
|
|
|
2018-10-04 22:53:34 +03:00
|
|
|
message(STATUS "Fetching pdimov/mincmake")
|
2018-10-08 23:22:04 +03:00
|
|
|
FetchContent_Populate(pdimov_mincmake QUIET GIT_REPOSITORY https://github.com/pdimov/mincmake GIT_TAG master)
|
2018-09-30 16:05:45 +03:00
|
|
|
include(${pdimov_mincmake_SOURCE_DIR}/cmake/boost_test.cmake)
|
2018-09-28 17:55:52 +03:00
|
|
|
|
2018-10-04 22:53:34 +03:00
|
|
|
message(STATUS "Fetching boostorg/assert")
|
2018-10-08 23:22:04 +03:00
|
|
|
FetchContent_Populate(boostorg_assert QUIET GIT_REPOSITORY https://github.com/boostorg/assert GIT_TAG develop)
|
2018-09-30 16:05:45 +03:00
|
|
|
add_subdirectory(${boostorg_assert_SOURCE_DIR} ${boostorg_assert_BINARY_DIR})
|
2018-09-28 17:55:52 +03:00
|
|
|
|
2018-10-04 22:53:34 +03:00
|
|
|
message(STATUS "Fetching boostorg/config")
|
2018-10-08 23:22:04 +03:00
|
|
|
FetchContent_Populate(boostorg_config QUIET GIT_REPOSITORY https://github.com/boostorg/config GIT_TAG develop)
|
2018-09-30 16:05:45 +03:00
|
|
|
add_subdirectory(${boostorg_config_SOURCE_DIR} ${boostorg_config_BINARY_DIR})
|
2018-09-28 17:55:52 +03:00
|
|
|
|
2018-10-04 22:53:34 +03:00
|
|
|
message(STATUS "Fetching boostorg/core")
|
2018-10-08 23:22:04 +03:00
|
|
|
FetchContent_Populate(boostorg_core QUIET GIT_REPOSITORY https://github.com/boostorg/core GIT_TAG develop)
|
2018-09-30 16:05:45 +03:00
|
|
|
add_subdirectory(${boostorg_core_SOURCE_DIR} ${boostorg_core_BINARY_DIR})
|
2018-09-28 17:55:52 +03:00
|
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
|
|
|
|
|
|
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
|
|
|
|
|
2018-09-30 21:49:46 +03:00
|
|
|
# --target install
|
|
|
|
|
|
|
|
|
|
set(CONFIG_INSTALL_DIR lib/cmake/${PROJECT_NAME}-${PROJECT_VERSION})
|
|
|
|
|
|
|
|
|
|
install(TARGETS boost_mp11 EXPORT ${PROJECT_NAME}Targets)
|
|
|
|
|
install(EXPORT ${PROJECT_NAME}Targets DESTINATION ${CONFIG_INSTALL_DIR} NAMESPACE Boost:: FILE ${PROJECT_NAME}Config.cmake)
|
|
|
|
|
|
|
|
|
|
install(DIRECTORY include/ DESTINATION include)
|
|
|
|
|
|
|
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
|
|
|
|
|
|
# Mp11 is independent of 32/64, so this hack makes BoostMp11ConfigVersion.cmake skip the check
|
|
|
|
|
set(OLD_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
|
|
|
|
|
unset(CMAKE_SIZEOF_VOID_P)
|
|
|
|
|
write_basic_package_version_file("${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" COMPATIBILITY AnyNewerVersion)
|
|
|
|
|
set(CMAKE_SIZEOF_VOID_P ${OLD_CMAKE_SIZEOF_VOID_P})
|
|
|
|
|
|
|
|
|
|
install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" DESTINATION ${CONFIG_INSTALL_DIR})
|
|
|
|
|
|
|
|
|
|
#export(EXPORT ${PROJECT_NAME}Targets NAMESPACE Boost:: FILE ${PROJECT_NAME}Config.cmake)
|
|
|
|
|
|
2018-09-28 17:55:52 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(COMMAND boost_test)
|
|
|
|
|
|
|
|
|
|
add_subdirectory(test)
|
|
|
|
|
|
|
|
|
|
endif()
|