Boost logo

Boost :

Subject: Re: [boost] [cmake] Pull request announcement
From: Gavin Lambert (boost_at_[hidden])
Date: 2018-09-17 03:03:01


On 17/09/2018 06:12, Niall Douglas wrote:
>>> Could you elaborate, why this would require separate/conflicting
>>> cmake files as opposed to having multiple different targets in a
>>> single file?
>>
>> If I include your project's root CMake file that contains tests
>> added by add_test(), then I cannot avoid those when running my own
>> tests.

I don't think it's sufficiently useful, but there is a CONFIGURATIONS
parameter on add_test which allows limiting tests to specific named
configurations.

Probably more useful is to condition it on some project-specific
property that's defined when you want to run tests.

> The way I've solved this in my cmake is to detect if the project is the
> root project or not. So if the base CMakeLists.txt in the build is mine,
> I compile in tests etc. If it is not, I assume I am being included as a
> dependency, and leave out lots of stuff.

That sounds simple enough when you're a single project being built
directly or not.

It doesn't sound like it would work when someone wants to run "all Boost
tests", or if someone using your library as a dependency does indeed
want to run your tests.


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