I'm using the conan package manager to install my dependencies for a project. That project needs boost system only of all boost libraries, since I'm only using asio and beast.
However, conan installs every part of boost, which is undesirable. If I'm installing it through a docker container on a mac machine, it takes more than an hour and the boost directory in the conan cache is more than one gigabyte on any platform, which is ten time more heavy than all other libraries combined.
I only want to install Boost.system, which in general should be quite lightweight. Is there a way to do that? Here's the conent of my conan file:
[requires]
boost/1.73.0 # here! I'd like something like "boost.system/1.73.0"
nlohmann_json/3.9.0
fmt/7.0.2
# other libs...
[generators]
cmake
[options]
nlohmann_json:implicit_conversions=False
I'm requiring boost 1.73 and I will switch to requiring 1.74 soon.
In my CMake, I do this:
target_link_libraries(my_app PRIVATE Boost::system)
Everything works there, but it's still much much more heavy than it should be, and it slows down deployment significantly.
You are looking for Boost 1.73.0 from Conan Center Index, which is the more recent version available in CCI. However, the idea will be using Components instead of creating a new recipe for each module. Why? We learned from Bincrafters that's hard to maintain, some fixes can affect all modules and replicating will require more effort. Thus, the main idea will consuming boost/1.73.0
, just like you have, but requiring only what you need:
target_link_libraries(foobar boost::system)
Currently, there is a Pull Request under development to provide Components in Boost. From Bincrafters side, the modular Boost update is stopped due the Conan Center Index's advantage. One of main challenges is solving the cyclical dependency between Boost's modules, in Bincrafters we did "manually", but now in CCI we are using boost-dep, which will be much better.
So if you don't have boost.system available, what can you do now? Use options, disable what you don't want and build from sources. Or, use find_library
to list only Boost.System
Update
: Now, Pull Request was merged in the CCI, and boost components are available for all conan boost versions (starting from 1.69.0
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With