Boost logo

Boost-Build :

From: João Abecasis (jpabecasis_at_[hidden])
Date: 2006-04-19 06:32:42


Emil Dotchevski wrote:
> I need to test each header in my libs, to make sure that it compiles without
> errors when included as the first header in a CPP. What is the easiest way
> to accomplish this?
>
> I was thinking of writing a simple tool which takes the command line for the
> complier, generates a CPP file which includes the specified header and then
> runs the compiler, however this would have to interface somehow with
> boost-build, to get the command line (depending on the toolset used, and the
> configuration), and I don't know how to do that.
>
> Any suggestions?

Incidentally, just yesterday I finally ported to bjam+BBv2 a shell
script I've been using for the same purpose. See attached. You should
put headers.jam file in the same directory as your Jamfile[.v2] or
somewhere where Boost.Build can find it (e.g., in BOOST_BUILD_PATH).

For example, to test the compilation of Boost.Spirit headers, in
(boost-root)/libs/spirit/test/Jamfile.v2 one could have:

     import headers ;
     import testing ;

     test-suite "spirit.headers"
         : [ headers ../../../boost/spirit ]
         ;

At this point the code is the documentation, but I added some comments
explaining each function's purpose.

Perhaps this, or something along the lines of it, could be added to the
regression tests, to ensure that all headers compile independently.
FWIW, my former bash script used to report lots of non-compilable files
inside boost.

What do others think about this? I'd like to hear your comments on the
approach and implementation, as well as bug reports ;-)

Best regards,

João




Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk