From 0cf2e8994868cbb94304e7226d123c32ad625e90 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 18 Sep 2020 12:23:13 +0800 Subject: [PATCH] cmake: introduce Boost::MPL interface library Signed-off-by: Kefu Chai --- src/CMakeLists.txt | 10 ++++++++++ src/crimson/admin/CMakeLists.txt | 3 ++- src/crimson/osd/CMakeLists.txt | 1 + src/osd/CMakeLists.txt | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 38d33bac44ac9..7a86043e5fbe2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -305,6 +305,16 @@ else() include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/src/fmt/include") endif() +# in osd/PeeringState.h, the number of elements in PeeringState::Active::reactions +# is now 21 which exceeds the default value of BOOST_MPL_LIMIT_VECTOR_SIZE, which +# is 20. so we need to override it. see +# https://www.boost.org/doc/libs/1_74_0/libs/mpl/doc/refmanual/limit-list-size.html +# link with this library, if your code includes osd/PeeringState.h (indirectly) +add_library(Boost::MPL INTERFACE IMPORTED) +set_target_properties(Boost::MPL PROPERTIES + INTERFACE_COMPILE_DEFINITIONS + "BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS;BOOST_MPL_LIMIT_LIST_SIZE=30") + if(WITH_SEASTAR) find_package(c-ares 1.13.0 QUIET) if(NOT c-ares_FOUND) diff --git a/src/crimson/admin/CMakeLists.txt b/src/crimson/admin/CMakeLists.txt index e92525e7084a6..aa07717351010 100644 --- a/src/crimson/admin/CMakeLists.txt +++ b/src/crimson/admin/CMakeLists.txt @@ -4,4 +4,5 @@ add_library(crimson-admin STATIC pg_commands.cc) target_link_libraries(crimson-admin - crimson::cflags) + crimson::cflags + Boost::MPL) diff --git a/src/crimson/osd/CMakeLists.txt b/src/crimson/osd/CMakeLists.txt index 2d0332848364a..898f70c423697 100644 --- a/src/crimson/osd/CMakeLists.txt +++ b/src/crimson/osd/CMakeLists.txt @@ -47,6 +47,7 @@ target_link_libraries(crimson-osd crimson-os crimson fmt::fmt + Boost::MPL dmclock::dmclock) set_target_properties(crimson-osd PROPERTIES POSITION_INDEPENDENT_CODE ${EXE_LINKER_USE_PIE}) diff --git a/src/osd/CMakeLists.txt b/src/osd/CMakeLists.txt index 691c1d2280cd7..7cd45171a73a1 100644 --- a/src/osd/CMakeLists.txt +++ b/src/osd/CMakeLists.txt @@ -46,7 +46,7 @@ if(HAS_VTA) endif() add_library(osd STATIC ${osd_srcs}) target_link_libraries(osd - PUBLIC dmclock::dmclock + PUBLIC dmclock::dmclock Boost::MPL PRIVATE os heap_profiler cpu_profiler ${CMAKE_DL_LIBS}) if(WITH_LTTNG) add_dependencies(osd osd-tp pg-tp) -- 2.39.5