Boost logo

Boost :

Subject: Re: [boost] Boost tests with cmake
From: P F (pfultz2_at_[hidden])
Date: 2017-07-29 13:46:09


> On Jul 29, 2017, at 3:09 AM, Louis Dionne via Boost <boost_at_[hidden]> wrote:
>
> Boost - Dev mailing list wrote
>> 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
>
> I think this is absolutely incredible. I may not agree with every last
> detail about how
> BCM handles things, but my opinion is that this is the way we should go.
> Based on
> your example and the dependency report, I think it should be easy to do MPL
> + Fusion
> (I can have a shot at those). I'll also give a shot at making Hana use the
> same
> conventions you do with BCM and I'll be able to provide some feedback based
> on
> actual experience.

Sure. The next step is try to integrate this into the scripting I have to generate the cmake. This way we can create a full build with the tests working.

Also, we need to figure out how to approach Boost.Config’s require rule it adds with cmake. It probably just be config check, and the user can write their own conditional in cmake.

There is a few changes I made to the testing in this example so it works on the small subset(config and core depend on type traits), but for the full build these changes won’t be necessary.


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