foundationdb/cmake/CompileBoost.cmake

27 lines
876 B
CMake
Raw Normal View History

2020-02-15 10:10:13 +08:00
find_package(Boost 1.72)
2018-05-03 00:55:29 +08:00
2018-05-06 02:11:17 +08:00
if(Boost_FOUND)
add_library(boost_target INTERFACE)
target_link_libraries(boost_target INTERFACE Boost::boost)
2018-05-03 00:55:29 +08:00
else()
2018-05-06 02:11:17 +08:00
include(ExternalProject)
ExternalProject_add(boostProject
2020-02-15 10:10:13 +08:00
URL "https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.bz2"
URL_HASH SHA256=59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722
2018-05-06 02:11:17 +08:00
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
BUILD_IN_SOURCE ON
INSTALL_COMMAND ""
UPDATE_COMMAND ""
BUILD_BYPRODUCTS <SOURCE_DIR>/boost/config.hpp)
2018-05-03 00:55:29 +08:00
2018-05-06 02:11:17 +08:00
ExternalProject_Get_property(boostProject SOURCE_DIR)
2018-05-03 00:55:29 +08:00
2018-05-06 02:11:17 +08:00
set(BOOST_INCLUDE_DIR ${SOURCE_DIR})
message(STATUS "Boost include dir ${BOOST_INCLUDE_DIR}")
2018-05-03 00:55:29 +08:00
2018-05-06 02:11:17 +08:00
add_library(boost_target INTERFACE)
add_dependencies(boost_target boostProject)
2020-07-10 06:02:43 +08:00
target_include_directories(boost_target SYSTEM INTERFACE ${BOOST_INCLUDE_DIR})
2018-05-06 02:11:17 +08:00
endif()