62 lines · plain
1# Copyright 2020 Peter Dimov2# Copyright 2021 Matt Borland3# Distributed under the Boost Software License, Version 1.0.4# https://www.boost.org/LICENSE_1_0.txt5 6cmake_minimum_required(VERSION 3.5...3.16)7 8project(boost_math VERSION 1.89.0 LANGUAGES CXX)9 10add_library(boost_math INTERFACE)11 12add_library(Boost::math ALIAS boost_math)13 14target_include_directories(boost_math INTERFACE include)15if(NOT CMAKE_VERSION VERSION_LESS "3.19")16 file(GLOB_RECURSE headers include/*.hpp)17 target_sources(boost_math PRIVATE ${headers})18endif()19 20include(CMakeDependentOption)21 22cmake_dependent_option(BOOST_MATH_STANDALONE "Use Boost.Math in standalone mode" ON "NOT BOOST_SUPERPROJECT_VERSION" OFF)23 24message(STATUS "Boost.Math: standalone mode ${BOOST_MATH_STANDALONE}")25 26if(BOOST_MATH_STANDALONE)27 28 target_compile_definitions(boost_math INTERFACE BOOST_MATH_STANDALONE=1)29 30else()31 32 target_link_libraries(boost_math33 INTERFACE34 Boost::assert35 Boost::concept_check36 Boost::config37 Boost::core38 Boost::integer39 Boost::lexical_cast40 Boost::predef41 Boost::random42 Boost::static_assert43 Boost::throw_exception44 )45 46endif()47 48if(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 project53elseif(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 61endif()62