add boost library

This commit is contained in:
Bechir Braham
2024-04-09 15:45:01 +02:00
parent a48820059d
commit 59b04ad6e8
4 changed files with 48 additions and 11 deletions

View File

@ -27,6 +27,8 @@ option(AARE_FETCH_PYBIND11 "Use FetchContent to download pybind11" ON)
option(AARE_FETCH_CATCH "Use FetchContent to download catch2" ON)
option(AARE_FETCH_JSON "Use FetchContent to download nlohmann::json" ON)
option(AARE_FETCH_ZMQ "Use FetchContent to download libzmq" ON)
option(AARE_FETCH_BOOST "Use FetchContent to download boost" ON)
#Convenience option to use system libraries
option(AARE_SYSTEM_LIBRARIES "Use system libraries" OFF)
@ -37,6 +39,8 @@ if(AARE_SYSTEM_LIBRARIES)
set(AARE_FETCH_CATCH OFF CACHE BOOL "Disabled FetchContent for catch2" FORCE)
set(AARE_FETCH_JSON OFF CACHE BOOL "Disabled FetchContent for nlohmann::json" FORCE)
set(AARE_FETCH_ZMQ OFF CACHE BOOL "Disabled FetchContent for libzmq" FORCE)
set(AARE_FETCH_BOOST OFF CACHE BOOL "Disabled FetchContent for boost" FORCE)
endif()
@ -72,9 +76,26 @@ if (AARE_FETCH_FMT)
)
FetchContent_MakeAvailable(fmt)
else()
find_package(fmt 6 REQUIRED)
find_package(fmt 6 REQUIRED)
endif()
if (AARE_FETCH_BOOST)
set(BOOST_INCLUDE_LIBRARIES program_options)
set(BOOST_ENABLE_CMAKE ON)
FetchContent_Declare(
Boost
GIT_REPOSITORY https://github.com/boostorg/boost.git
GIT_TAG boost-1.80.0
)
FetchContent_MakeAvailable(Boost)
else()
find_package(Boost 1.80 REQUIRED COMPONENTS program_options)
endif()
add_library(aare_compiler_flags INTERFACE)
target_compile_features(aare_compiler_flags INTERFACE cxx_std_17)
@ -88,7 +109,7 @@ else()
INTERFACE
-Og
-ggdb3
-D_GLIBCXX_DEBUG
# -D_GLIBCXX_DEBUG # causes errors with boost
-D_GLIBCXX_DEBUG_PEDANTIC
)
@ -153,7 +174,7 @@ add_subdirectory(network_io)
#Overall target to link to when using the library
add_library(aare INTERFACE)
target_link_libraries(aare INTERFACE core file_io utils network_io)
target_link_libraries(aare INTERFACE core file_io utils network_io ${Boost_LIBRARIES})
target_include_directories(aare INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>