I’m curious to hear common setup of Boost with CMake by the community.
I used to only be aware of FindBoost
but have recently learned of some more options. I’d be interested to hear pros/cons people have run into.
-
FindBoost
- The CMake documents using Boost through FindBoost. This has been adequate on my project so far but does require something else (package manager, containers, scripts) to manage the installation of Boost. Furthermore, this option can pose challenging for embedded projects that need to build Boost libraries for multiple platforms.
-
Github Boost Project CMake File
- I recently discovevered there is a top level CMakeLists.txt in the Boost Github Project which is not included in Boost releases on the Boost Website (or from apt install). However, this Infrastructure does setup more granular targets (like
Boost::signals2
instead ofBoost::headers
) and provide the ability to build compile-necessary targets too (like filesystem). That infrastructure does warn in their README thatbuilding Boost with CMake does not work yet and is not supported
. However, despite “does not work yet”, I have been able to successfully cross-compile some targets (filesystem) using this CMake setup. Yet even for header only usage, this does provide a more granular way to access Boost. Furthermore, this lets Boost be used with FetchContent or CPM allowing us to manage Boost more directly through CMake. It is important to note though, when this option is used, it does appear that the find_package(Boost) is not supported. Which can create some inconsistent use of Boost between CMake projects.
- I recently discovevered there is a top level CMakeLists.txt in the Boost Github Project which is not included in Boost releases on the Boost Website (or from apt install). However, this Infrastructure does setup more granular targets (like
- Other options?
I’m curious to hear about others experience with any of these options or new options? Have others succesfully used the CMake Infrastructure present in the Boost Github Project. Does anyone know reasons why Boost still claims it experimental (I might ping their mailing lists). Have others been found a more effective way to manage cross platform builds of Boost with CMake?