Hacker News new | past | comments | ask | show | jobs | submit login

How do people go about integrating boost these days? For any cross platform projects I use CMake and Boost seems like a _very_ scary library to try and build/ship on multiple platforms.



I use CMake almost exclusively (even for Windows) and using "find_package(Boost REQUIRED)" works most of the time. A lot of common boost libraries (algorithm, geometry) are header only and are not much of a hassle to include.

IIRC, you would need to modify the statement to "find_package(Boost REQUIRED COMPONENTS filesystem)" if you want to use boost dependencies that need a separate .dll/.so (in this case boost::filesystem). However I rarely need to use these, so I may be wrong.


You should be able to build and include boost json as a standalone subproject in CMake if you are using C++17. (Or also possible to use as header only lib)

It gets far more complicated with C++11, since you also need a ton of other boost modules there.

For more Details you can read the Readme of it. https://github.com/boostorg/json


CMake supports Boost out of the box, you just need to set BOOST_ROOT to your Boost install path.

With proper CI it's not a big deal


What exactly makes Boost scary to ship? I understand that Boost requires some attention to build right across platforms (see zlib support in Windows) but other than this it's pretty straight forward to add a FindBoost statement to your code, and move onto other things.


Use Hunter for dependency management

https://github.com/cpp-pm/hunter

There is a bit of a learning curve, but it's the only dependency manager that does things right (all from within CMake)


    wget boost_1_77.tar.gz
    tar xaf boost*
    cmake ... -DBOOST_ROOT=.../boost_1_77
Works for the huge majority of boost ; most parts that required a build were the parts that were integrated in c++ like thread, regex, chrono, filesystem


FWIW Boost.Json in particular doesn't have any source files, it's just header-only templates. You don't actually need to build or link boost to use it; you just need the header files to be in the include path.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: