Last active
January 30, 2020 15:08
-
-
Save bingmann/a7fa6276012bd416fa81c580c9eedd36 to your computer and use it in GitHub Desktop.
Build a "mini-boost" library directly from cmake including only some of the library-needing boost parts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### use Boost libraries ### | |
include(FetchContent) | |
FetchContent_Populate( | |
boost-src | |
URL https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2 | |
URL_HASH MD5=4cdf9b5c2dc01fb2b7b733d5af30e558 | |
SOURCE_DIR extlib/boost | |
) | |
include_directories(SYSTEM ${CMAKE_CURRENT_BINARY_DIR}/extlib/boost/) | |
# glob boost sources | |
file(GLOB TBT_MINI_BOOST_SOURCES | |
${CMAKE_CURRENT_BINARY_DIR}/extlib/boost/libs/system/src/*.cpp | |
${CMAKE_CURRENT_BINARY_DIR}/extlib/boost/libs/regex/src/*.cpp | |
) | |
add_library(tbt_mini_boost STATIC "${TBT_MINI_BOOST_SOURCES}") | |
set_target_properties(tbt_mini_boost PROPERTIES LINKER_LANGUAGE CXX) | |
set(Boost_LIBRARIES tbt_mini_boost) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It auto-downloads the source as well.