Boost logo

Boost :

Subject: [boost] Boost tests with cmake
From: paul (pfultz2_at_[hidden])
Date: 2017-07-29 00:03:41


Hi,

So, I have made a small demo setting up the tests with cmake, here:

https://github.com/pfultz2/boost-cmake-demo/tree/bcm-test-demo

This builds and tests the libraries for Boost.System, so it includes:

* assert
* config
* core
* predef
* static_assert
* system
* winapi

There are no tests for winapi right now, because I don't have a windows
machine to test on(but I suppose I could've tested with mingw). 

This uses the BCM modules to provide common functionality for building and
tests. All the tests are setup to run through CTest, and some targets are
provided for building the tests.

A `tests` target will build(but not run) all the tests. The `check` target
will build and run all tests. 

Since we do want to filter tests by library, all tests are added with the
label of the project name(which can be filtered with `ctest -L <label>`).
Furthermore there are targets `tests-<project-name>` and `check-<project-
name>` that will build and test a single project respectively. So if we are
only interested in the tests for `boost_assert` we can run:

cmake --build . --target check-boost_assert

And this will build and test `boost_assert`. 

Any feedback will be useful as we move forward on adding the rest of the tests
to cmake.

Paul


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