Subject: Re: [boost] Boost header isolation testing
From: Roger Leigh (rleigh_at_[hidden])
Date: 2018-10-15 19:43:21


On 15/10/18 20:11, Mateusz Loskot via Boost wrote:
> On Mon, 15 Oct 2018 at 20:00, James E. King III via Boost
> <boost_at_[hidden]> wrote:
>>
>> In the winapi project there's a neat little Jamfile rule that will ensure
>> each public header will compile properly (i.e. it is not missing any
>> #include statements). I pulled this into uuid when I started maintaining
>> it, and I find myself pulling it into another repository.
>
> I've done similar for GIL:
> https://github.com/boostorg/gil/pull/147
>
>> It would be nice to have this as a standard Boost.Build rule that one could easily add to
>> test Jamfiles.

Note for the CMake side this is pretty simple to automate here. An
example would be these functions:

 
https://gitlab.com/rleigh/ome-files-cpp/blob/master/cmake/HeaderTest.cmake

which are used here

 
https://gitlab.com/rleigh/ome-files-cpp/blob/master/cmake/HeaderTest.cmake
 
https://gitlab.com/rleigh/ome-files-cpp/blob/master/test/ome-files/CMakeLists.txt#L45

to generate a list of headers to test and then to build and run the
tests. This tests both inclusion and double-inclusion to check for ODR
violations and problems with include guards.

The above were created for a specific project and aren't generic, but an
equivalent could easily be written for Boost.

Regards,
Roger