2024-09-23 16:01:31 +08:00
|
|
|
# Copyright (c) 2023, AgiBot Inc.
|
|
|
|
# All rights reserved.
|
|
|
|
|
|
|
|
include(FetchContent)
|
|
|
|
|
2024-10-14 21:23:01 +08:00
|
|
|
message(STATUS "get boost...")
|
2024-09-23 16:01:31 +08:00
|
|
|
|
|
|
|
set(boost_DOWNLOAD_URL
|
2024-10-14 21:23:01 +08:00
|
|
|
"https://github.com/boostorg/boost/releases/download/boost-1.82.0/boost-1.82.0.tar.xz"
|
2024-09-23 16:01:31 +08:00
|
|
|
CACHE STRING "")
|
|
|
|
|
2024-10-14 21:23:01 +08:00
|
|
|
if(boost_LOCAL_SOURCE)
|
|
|
|
FetchContent_Declare(
|
|
|
|
boost
|
|
|
|
SOURCE_DIR ${boost_LOCAL_SOURCE}
|
|
|
|
OVERRIDE_FIND_PACKAGE)
|
2024-09-23 16:01:31 +08:00
|
|
|
else()
|
2024-10-14 21:23:01 +08:00
|
|
|
FetchContent_Declare(
|
|
|
|
boost
|
|
|
|
URL ${boost_DOWNLOAD_URL}
|
|
|
|
DOWNLOAD_EXTRACT_TIMESTAMP ON
|
|
|
|
OVERRIDE_FIND_PACKAGE)
|
|
|
|
endif()
|
2024-09-23 16:01:31 +08:00
|
|
|
|
2024-11-07 21:17:34 +08:00
|
|
|
# Wrap it in a function to restrict the scope of the variables
|
|
|
|
function(get_boost)
|
|
|
|
FetchContent_GetProperties(boost)
|
|
|
|
if(NOT boost_POPULATED)
|
|
|
|
set(BOOST_INCLUDE_LIBRARIES asio beast)
|
2024-09-23 16:01:31 +08:00
|
|
|
|
2024-11-07 21:17:34 +08:00
|
|
|
set(Boost_USE_STATIC_LIBS ON)
|
2024-09-23 16:01:31 +08:00
|
|
|
|
2024-11-07 21:17:34 +08:00
|
|
|
FetchContent_MakeAvailable(boost)
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
get_boost()
|