File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Copyright 2020 Peter Dimov
2+ # Copyright 2021 Matt Borland
3+ # Distributed under the Boost Software License, Version 1.0.
4+ # https://www.boost.org/LICENSE_1_0.txt
5+
6+ cmake_minimum_required (VERSION 3.5...3.16 )
7+
8+ project (boost_math VERSION 1.89.0 LANGUAGES CXX )
9+
10+ add_library (boost_math INTERFACE )
11+
12+ add_library (Boost::math ALIAS boost_math )
13+
14+ target_include_directories (boost_math INTERFACE include )
15+ if (NOT CMAKE_VERSION VERSION_LESS "3.19" )
16+ file (GLOB_RECURSE headers include /*.hpp )
17+ target_sources (boost_math PRIVATE ${headers} )
18+ endif ()
19+
20+ include (CMakeDependentOption )
21+
22+ cmake_dependent_option (BOOST_MATH_STANDALONE "Use Boost.Math in standalone mode" ON "NOT BOOST_SUPERPROJECT_VERSION" OFF )
23+
24+ message (STATUS "Boost.Math: standalone mode ${BOOST_MATH_STANDALONE} " )
25+
26+ if (BOOST_MATH_STANDALONE)
27+
28+ target_compile_definitions (boost_math INTERFACE BOOST_MATH_STANDALONE=1 )
29+
30+ else ()
31+
32+ target_link_libraries (boost_math
33+ INTERFACE
34+ Boost::assert
35+ Boost::concept_check
36+ Boost::config
37+ Boost::core
38+ Boost::integer
39+ Boost::lexical_cast
40+ Boost::predef
41+ Boost::random
42+ Boost::static_assert
43+ Boost::throw_exception
44+ )
45+
46+ endif ()
47+
48+ if (BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR } /test/CMakeLists.txt" )
49+
50+ add_subdirectory (test )
51+
52+ # Only enable tests when we're the root project
53+ elseif (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
54+
55+ include (CTest )
56+ add_subdirectory (test )
57+
58+ include (GNUInstallDirs )
59+ install (DIRECTORY "include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR} " )
60+
61+ endif ()
You can’t perform that action at this time.
0 commit comments