You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.7 KiB
CMake

# Additional infos:
# - https://github.com/boostorg/cmake#using-boost-with-fetchcontent
#
# Find all components:
# set(Boost_DEBUG ON) # before adding include(cmake/FetchBoost.cmake) in CMakeLists.txt
# (https://stackoverflow.com/questions/29989512/where-can-i-find-the-list-of-boost-component-that-i-can-use-in-cmake)
#
# Linking:
# target_link_libraries(${PROJECT_NAME} PRIVATE
# Boost::dll
# Boost::<lib>
# )
if (NOT DEFINED BOOST_GIT_TAG)
message(FATAL_ERROR "BOOST_GIT_TAG is not defined.\n see https://github.com/boostorg/boost and grab a release tag.\n example: set(BOOST_GIT_TAG boost-1.81.0)")
endif()
if (NOT DEFINED BOOST_INCLUDE_LIBRARIES)
message(FATAL_ERROR "BOOST_INCLUDE_LIBRARIES is not defined. \n example: set(BOOST_INCLUDE_LIBRARIES thread filesystem system program_options dll pfr).")
endif()
#######################################################################################################################
# Boost options
#######################################################################################################################
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(BOOST_ENABLE_CMAKE ON)
#######################################################################################################################
# Fetch boost from github
#######################################################################################################################
FetchContent_Declare(
Boost
GIT_REPOSITORY https://github.com/boostorg/boost.git
GIT_TAG ${BOOST_GIT_TAG}
)
include(${CMAKE_SOURCE_DIR}/cmake/Utils.cmake)
print_git_tag(${BOOST_GIT_TAG})