FetchContent with Boost

you are right, but this is not the problem!
The boost cmake system is designed to use it only standalone for boost developers.

It is possible, but hard, you will just end in installing the hole set of boost libraries:

list(TRANSFORM BOOST_INCLUDE_LIBRARIES PREPEND boost_ OUTPUT_VARIABLE BOOST_TARGETS)
install(TARGETS ${BOOST_TARGETS} EXPORT ${PROJECT_NAME}Targets)
-- Configuring done (0.9s)
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_asio" which requires target "boost_align" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_asio" which requires target "boost_assert" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_asio" which requires target "boost_config" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_asio" which requires target "boost_context" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_asio" which requires target "boost_coroutine" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_asio" which requires target "boost_date_time" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_asio" which requires target "boost_system" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_asio" which requires target "boost_throw_exception" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_filesystem" which requires target "boost_assert" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_filesystem" which requires target "boost_config" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_filesystem" which requires target "boost_container_hash" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_filesystem" which requires target "boost_core" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_filesystem" which requires target "boost_detail" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_filesystem" which requires target "boost_io" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_filesystem" which requires target "boost_iterator" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_filesystem" which requires target "boost_smart_ptr" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_filesystem" which requires target "boost_system" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_filesystem" which requires target "boost_type_traits" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_array" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_assert" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_config" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_core" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_detail" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_integer" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_io" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_iterator" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_move" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_mpl" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_optional" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_predef" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_preprocessor" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_smart_ptr" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_spirit" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_static_assert" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_type_traits" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_unordered" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_utility" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_serialization" which requires target "boost_variant" that is not in any export set.
CMake Error: install(EXPORT "tftpdTargets" ...) includes target "boost_filesystem" which requires target "boost_atomic" that is not in any export set.
-- Generating done (0.1s)
CMake Generate step failed.  Build files cannot be regenerated correctly.

IMHO: this is much simpler to use and with cache the fastest way to build:

option(BUILD_SHARED_LIBS "Build shared libraries" YES)
set(BOOST_INCLUDE_LIBRARIES filesystem asio headers)
CPMAddPackage("gh:ClausKlein/boost-cmake@1.81.0-rc2")

see Bump to boost v1.81.0 by ClausKlein · Pull Request #6 · ClausKlein/boost-cmake · GitHub

see too install(RUNTIME_DEPENDENCY_SET appDeps) does nothing install?

I’m unable to get the Boost::mpi package with this fetch content (serialization works though). I have the same issue using GIT_REPOSITORY and GIT_TAG

        set(BOOST_INCLUDE_LIBRARIES serialization mpi)
        set(BOOST_ENABLE_CMAKE ON)
        FetchContent_Declare(
                Boost
                URL https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.7z
                USES_TERMINAL_DOWNLOAD TRUE
                DOWNLOAD_NO_EXTRACT FALSE
              )
        FetchContent_MakeAvailable(Boost)

Dit you read the README from boost cmake?

bash-5.2$ head tools/cmake/README.md 
# Boost CMake support infrastructure

This repository hosts the `tools/cmake` Boost submodule, containing
the CMake support infrastructure for Boost.

Note that the officially supported way to build Boost remains
[with `b2`](https://www.boost.org/more/getting_started/index.html).

## Building Boost with CMake

bash-5.2$ 
1 Like

Oops! Thanks for pointing it out

BOOST_ENABLE_MPI

Set to ON if Boost libraries depending on MPI should be built.