Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / assert / CMakeLists.txt
1 # Copyright 2018 Mike Dev
2 # Copyright 2018 Peter Dimov
3 # Distributed under the Boost Software License, Version 1.0.
4 # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
5
6 # Partial (add_subdirectory only) and experimental CMake support
7 # Subject to change; please do not rely on the contents of this file yet
8
9 cmake_minimum_required(VERSION 3.5)
10
11 project(BoostAssert VERSION 1.72.0 LANGUAGES CXX)
12
13 add_library(boost_assert INTERFACE)
14 add_library(Boost::assert ALIAS boost_assert)
15
16 target_include_directories(boost_assert INTERFACE include)
17
18 target_link_libraries(boost_assert
19     INTERFACE
20         Boost::config
21 )
22
23 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
24
25     # `function` confuses FetchContent, sees empty CMAKE_CURRENT_LIST_DIR
26     macro(fetch_and_include name)
27
28         message(STATUS "Fetching ${name}")
29
30         file(DOWNLOAD
31             "https://raw.githubusercontent.com/pdimov/mincmake/master/${name}"
32             "${CMAKE_BINARY_DIR}/fetch_and_include/${name}"
33         )
34
35         include("${CMAKE_BINARY_DIR}/fetch_and_include/${name}")
36
37     endmacro()
38
39     fetch_and_include(cmake/boost_fetch.cmake)
40     fetch_and_include(cmake/boost_test.cmake)
41
42     boost_fetch(boostorg/config TAG develop)
43     boost_fetch(boostorg/core TAG develop)
44
45     enable_testing()
46     add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
47
48 endif()
49
50 if(COMMAND boost_test)
51
52     add_subdirectory(test)
53
54 endif()