# Boost
option(WITH_SYSTEM_BOOST "require and build with system Boost" OFF)
+set(BOOST_COMPONENTS
+ thread system regex random program_options date_time iostreams)
+if(WITH_MGR)
+ list(APPEND BOOST_COMPONENTS python)
+endif()
+
if (WITH_SYSTEM_BOOST)
if(ENABLE_SHARED)
set(Boost_USE_STATIC_LIBS OFF)
set(BOOST_SOURCE_DIR "${PROJECT_SOURCE_DIR}/src/boost")
set(BOOST_PREFIX "${PROJECT_BINARY_DIR}/boost")
set(BOOST_BUILD "${PROJECT_BINARY_DIR}/boost-build")
- set(Boost_USE_STATIC_LIBS ON)
+ string(REPLACE ";" "," BOOST_WITH_LIBS "${BOOST_COMPONENTS}")
execute_process(COMMAND "./bootstrap.sh"
"--prefix=${BOOST_PREFIX}"
- "--with-libraries=atomic,container,context,coroutine,coroutine2,date_time,filesystem,iostreams,program_options,python,random,regex,system,thread"
+ "--with-libraries=${BOOST_WITH_LIBS}"
WORKING_DIRECTORY ${BOOST_SOURCE_DIR})
- # 2. install headers
set(BOOST_ROOT "${BOOST_PREFIX}")
- execute_process(COMMAND "./b2"
- #"--buildid=ceph" # changes lib names--can omit for static
- "--variant=release" # could override
- "--link=static" # avoid library versioning issues
- "--threading=multi"
- "--build-dir=${BOOST_BUILD}"
- "-j${BOOST_J}"
- "cxxflags=${BOOST_CFLAGS}"
- "headers"
+ set(b2 ./b2
+ --build-dir=${BOOST_BUILD} -j${BOOST_J})
+ if(CMAKE_VERBOSE_MAKEFILE)
+ list(APPEND b2 -d1)
+ else()
+ list(APPEND b2 -d0)
+ endif()
+ list(APPEND b2
+ variant=release link=static threading=multi cxxflags=${BOOST_CFLAGS})
+ # 2. install headers
+ execute_process(COMMAND
+ ${b2}
+ headers
WORKING_DIRECTORY ${BOOST_SOURCE_DIR})
# 3. build and install libs
- execute_process(COMMAND "./b2"
- #"--buildid=ceph" # changes lib names--can omit for static
- "--variant=release" # could override
- "--link=static" # avoid library versioning issues
- "--threading=multi"
- "--build-dir=${BOOST_BUILD}"
- "-j${BOOST_J}"
- "cxxflags=${BOOST_CFLAGS}"
- "install"
+ execute_process(COMMAND
+ ${b2}
+ install
WORKING_DIRECTORY ${BOOST_SOURCE_DIR})
# 4. set hints for FindBoost.cmake
+ set(Boost_USE_STATIC_LIBS ON)
set(Boost_NO_SYSTEM_PATHS ON)
include_directories(BEFORE ${BOOST_PREFIX}/include)
# fixup for CheckIncludeFileCXX
set(Boost_USE_MULTITHREADED ON)
-set(BOOST_COMPONENTS
- thread system regex random program_options date_time iostreams)
-if(WITH_MGR)
- list(APPEND BOOST_COMPONENTS python)
-endif()
-
# require minimally the bundled version
find_package(Boost 1.61 COMPONENTS ${BOOST_COMPONENTS} REQUIRED)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})