File tree Expand file tree Collapse file tree 3 files changed +23
-120
lines changed
Expand file tree Collapse file tree 3 files changed +23
-120
lines changed Original file line number Diff line number Diff line change 11cmake_minimum_required (VERSION 3.12)
22project (Boost-CMake)
33
4- option (BOOST_DOWNLOAD_TO_BINARY_DIR "Prefer downloading Boost to the binary directory instead of source directory" OFF )
54option (BOOST_DISABLE_TESTS "Do not build test targets, even if building standalone" OFF )
65
76set (BOOST_URL "https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.bz2" CACHE STRING "Boost download URL" )
87set (BOOST_URL_SHA256 "8f32d4617390d1c2d16f26a27ab60d97807b35440d45891fa340fc2648b04406" CACHE STRING "Boost download URL SHA256 checksum" )
9- set (BOOST_ARCHIVE_DIRECTORY "" CACHE DIRECTORY "Use the specified local directory to search for boost archives instead of downloading them" )
108
11- list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} /cmake/Modules)
9+ include (FetchContent)
10+ FetchContent_Declare(
11+ Boost
12+ URL ${BOOST_URL}
13+ URL_HASH SHA256=${BOOST_URL_SHA256}
14+ )
15+ FetchContent_GetProperties(Boost)
1216
13- include (DownloadBoost)
17+ if (NOT Boost_POPULATED)
18+ FetchContent_Populate(Boost)
19+ set (BOOST_SOURCE ${boost_SOURCE_DIR} )
20+ endif ()
21+
22+ list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} /cmake/Modules)
23+ include (CheckBoostVersion)
1424
1525message (STATUS "Boost found: ${BOOST_VERSION} ${BOOST_SOURCE} " )
1626
Original file line number Diff line number Diff line change 1+ # Detect Boost version
2+ file (STRINGS "${BOOST_SOURCE} /boost/version.hpp" boost_version_raw
3+ REGEX "define BOOST_VERSION "
4+ )
5+ string (REGEX MATCH "[0-9]+" boost_version_raw "${boost_version_raw} " )
6+ math (EXPR BOOST_VERSION_MAJOR "${boost_version_raw} / 100000" )
7+ math (EXPR BOOST_VERSION_MINOR "${boost_version_raw} / 100 % 1000" )
8+ math (EXPR BOOST_VERSION_PATCH "${boost_version_raw} % 100" )
9+ set (BOOST_VERSION "${BOOST_VERSION_MAJOR} .${BOOST_VERSION_MINOR} .${BOOST_VERSION_PATCH} " )
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments