AimRT/cmake/GetBoost.cmake

38 lines
811 B
CMake
Raw Normal View History

2024-09-23 16:01:31 +08:00
# Copyright (c) 2023, AgiBot Inc.
# All rights reserved.
include(FetchContent)
message(STATUS "get boost...")
2024-09-23 16:01:31 +08:00
set(boost_DOWNLOAD_URL
"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 "")
if(boost_LOCAL_SOURCE)
FetchContent_Declare(
boost
SOURCE_DIR ${boost_LOCAL_SOURCE}
OVERRIDE_FIND_PACKAGE)
2024-09-23 16:01:31 +08:00
else()
FetchContent_Declare(
boost
URL ${boost_DOWNLOAD_URL}
DOWNLOAD_EXTRACT_TIMESTAMP ON
OVERRIDE_FIND_PACKAGE)
endif()
2024-09-23 16:01:31 +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
set(Boost_USE_STATIC_LIBS ON)
2024-09-23 16:01:31 +08:00
FetchContent_MakeAvailable(boost)
endif()
endfunction()
get_boost()