build: simplify Boost fetching logic (#26)
Streamline the process of finding and downloading Boost by removing unnecessary checks and consolidating the logic, making it easier to manage and maintain dependencies.
This commit is contained in:
parent
83611e9591
commit
81600602e3
@ -3,46 +3,32 @@
|
|||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
message(STATUS "Searching for Boost...")
|
message(STATUS "get boost...")
|
||||||
|
|
||||||
set(BOOST_VERSION 1.82.0)
|
|
||||||
set(boost_DOWNLOAD_URL
|
set(boost_DOWNLOAD_URL
|
||||||
"https://github.com/boostorg/boost/releases/download/boost-${BOOST_VERSION}/boost-${BOOST_VERSION}.tar.xz"
|
"https://github.com/boostorg/boost/releases/download/boost-1.82.0/boost-1.82.0.tar.xz"
|
||||||
CACHE STRING "")
|
CACHE STRING "")
|
||||||
|
|
||||||
find_package(Boost ${BOOST_VERSION} QUIET)
|
if(boost_LOCAL_SOURCE)
|
||||||
|
FetchContent_Declare(
|
||||||
if(Boost_FOUND)
|
boost
|
||||||
if(Boost_VERSION VERSION_EQUAL ${BOOST_VERSION})
|
SOURCE_DIR ${boost_LOCAL_SOURCE}
|
||||||
message(STATUS "Found compatible Boost version ${Boost_VERSION}")
|
OVERRIDE_FIND_PACKAGE)
|
||||||
else()
|
|
||||||
message(WARNING "Found newer Boost version ${Boost_VERSION}. Using local version, but this may cause issues.")
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
message(STATUS "Boost ${BOOST_VERSION} or greater not found locally. Downloading Boost ${BOOST_VERSION}")
|
FetchContent_Declare(
|
||||||
|
boost
|
||||||
if(boost_LOCAL_SOURCE)
|
URL ${boost_DOWNLOAD_URL}
|
||||||
FetchContent_Declare(
|
DOWNLOAD_EXTRACT_TIMESTAMP ON
|
||||||
boost
|
OVERRIDE_FIND_PACKAGE)
|
||||||
SOURCE_DIR ${boost_LOCAL_SOURCE}
|
endif()
|
||||||
OVERRIDE_FIND_PACKAGE)
|
|
||||||
message(STATUS "Using local Boost source")
|
FetchContent_GetProperties(boost)
|
||||||
else()
|
if(NOT boost_POPULATED)
|
||||||
FetchContent_Declare(
|
set(BOOST_INCLUDE_LIBRARIES asio beast)
|
||||||
boost
|
|
||||||
URL ${boost_DOWNLOAD_URL}
|
set(Boost_USE_STATIC_LIBS
|
||||||
DOWNLOAD_EXTRACT_TIMESTAMP ON
|
ON
|
||||||
OVERRIDE_FIND_PACKAGE)
|
CACHE BOOL "")
|
||||||
endif()
|
|
||||||
|
FetchContent_MakeAvailable(boost)
|
||||||
FetchContent_GetProperties(boost)
|
|
||||||
if(NOT boost_POPULATED)
|
|
||||||
set(BOOST_INCLUDE_LIBRARIES asio beast)
|
|
||||||
|
|
||||||
set(Boost_USE_STATIC_LIBS
|
|
||||||
ON
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
FetchContent_MakeAvailable(boost)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user