foundationdb/cmake/CompileBoost.cmake

27 lines
869 B
CMake
Raw Normal View History

find_package(Boost 1.67)
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
URL "https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.bz2"
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()