foundationdb/cmake/CompileBoost.cmake

27 lines
869 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"
2018-05-06 02:11:17 +08:00
URL_HASH SHA256=2684c972994ee57fc5632e03bf044746f6eb45d4920c343937a465fd67a5adba
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)
2018-05-06 02:11:17 +08:00
target_include_directories(boost_target INTERFACE ${BOOST_INCLUDE_DIR})
endif()