Boost logo

Boost :

From: Alexander Grund (alexander.grund_at_[hidden])
Date: 2024-05-21 07:24:27


Am 20.05.24 um 21:28 schrieb Robert Ramey via Boost:
> Anyone have first hand experience building/testing a boost
> library/application with CMake?  I've found the github project for
> boost/Cmake.  Can anyone point me to more useful information?

There are many libraries ready for building & testing with CMake:
Mentioned (Atomic, Filesystem, Log, JSON), Mine (Nowide, Locale) and
likely all Peter is maintaining.

Useful Information are in the Readme at https://github.com/boostorg/cmake

Examples in each library CI configs and the templates of Boost.CI:
https://github.com/boostorg/boost-ci/blob/master/.github/workflows/ci.yml

To get you started:

cd $BOOST_ROOT
mkdir build_cmake && cd build_cmake
variant=Debug # Or Relase, or RelWithDebInfo
cmake -DCMAKE_BUILD_TYPE=$variant
-DBOOST_INCLUDE_LIBRARIES='locale;atomic;log;time'
-DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON -DBoost_VERBOSE=ON ..
cmake --build . --target tests --config $variant -j 16
ctest --output-on-failure --no-tests=error -C $variant -j 16

- BUILD_SHARED_LIBS can be ON or OFF for shared or static libraries
- On Linux $variant typically only needs to be in the first `cmake`
invocation, but it doesn't hurt in the others
- Convenience targets "tests" and "check" exists (build command) to
build all tests (& dependencies) and run them ("check" target)

Alex




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk