Boost logo

Boost-Build :

From: João Abecasis (jpabecasis_at_[hidden])
Date: 2006-04-19 18:05:56


Emil Dotchevski wrote:
> Maybe because I'm running it under windows, I get errors which I think have
> to do with the escape sequences already mentioned...

If you think the problem is with the escaping you could try turning it
off completely, by commenting the contents of rule path-to-name (lines
73-76) and see how that goes.

> Please correct me if I'm wrong, but it seems to me there should be a simpler
> way to accomplish this. The boost-build system already has a nice feature
> for testing c/cpp files for compile errors:
>
> compile foo.cpp : : compile-test-foo ;
>
> Something along the following lines would be ideal:
>
> compile-header foo.h : : header-test-foo ;

Behind the scenes I'm using something like that. The problem only arises
because I'm recursing inside a (or many) directory and different
(sub)directories could contain files with the same name. If this
happens, we need to be able to tell the tests apart and the solution I
found was to make the path part of the test-name.

Anyway, as I said in my previous post, I'll see what can be done about it.

I could also provide a rule to test a single header file that would
forgo all the extra cruft.

> Perhaps we need an extra argument to the compile-header rule, to tell it
> whether to treat the header as C++ or C. I suppose implementing this would
> be easy, especially if the compiler has an option to tell it whether to
> treat the input file as C++ or C. If not, then it would be necessary to
> create a temporary .c/.cpp file which includes the header, and compile
> that -- but even in that case, the cpp file should be treated as the .rsp
> files, meaning that the user usually doesn't have to know about it.

Right now, it compiles everything as C++ files, but I could add some
logic to make it more intelligent in that regard. For instance

     .h -> compile as C
     .hpp -> compile as C++

> It is probably even possible to not add a special compile-header rule, but
> to modify the existing compile rule. In fact I tried to use it as-is with
> one of my headers, but I get this error:
>
> error: unable to construct ./test-info_int.h
> To debug this problem, try the --debug-generators option.

Right. If you read my code, you'll see the trick here is to cast the
header into a source file (rule compile-headers).

> I guess I should learn jam and code things like this myself instead of
> posting lame feature requests :) but for now unfortunatelly I really don't
> have the time...

;-)

Thanks for your comments,

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