How to build external non-CMake project after downloading it with FetchContent?
Hello,
my goal is to download the Boost repository if it isn't found and then build it the default way, i.e. using boostrap
and b2
tools.
I know, I can download it like this:
include(FetchContent)
FetchContent_Declare(
Boost
PREFIX external_dependencies/boost
GIT_REPOSITORY https://github.com/boostorg/boost.git
GIT_SUBMODULES libs/system libs/serialization libs/random
libs/function libs/config libs/headers libs/assert libs/core libs/integer
libs/type_traits libs/mpl libs/throw_exception libs/preprocessor libs/utility
libs/static_assert libs/smart_ptr libs/predef libs/move libs/io libs/iterator
libs/detail libs/spirit libs/optional libs/type_index libs/container_hash
libs/array libs/bind
tools/build tools/boost_install
)
FetchContent_GetProperties(Boost)
FetchContent_Populate(Boost)
But how can I build it now correctly? I'd like to run following commands:
./bootstrap.sh
./b2 headers
./b2 -q cxxflags="-fPIC" --layout=system variant=${BUILD_TYPE} link=${LINK_TYPE} address-model=64 --with-system --with-serialization --with-random
I'm thinking about add_custom_target() and add_custom_command() functions, but I'm not sure, if it's the recommended way to do this.