Boost logo

Boost-Build :

Subject: Re: [Boost-build] How to recursively add directories to the include path
From: Thomas Bretgeld (thomas.bretgeld_at_[hidden])
Date: 2011-08-02 12:38:35


Hi Thomas,

thank you for your answer. Putting the files into a local variable and then adding the ":D" works perfectly. Thats the trick I was missing (I suggest
putting this into the docs as an example - seems to me extremely useful). It looks like bjam even filters out duplicate paths automatically when
calling g++. However all paths are absolute pathnames, which makes the output of the commands (bjam -d2) quite big. Is there any easy way to convert
them to relative paths?

>> I am pretty new to boost.build and
>> couldn't find any documentation or examples for this problem online.
> I just search all files in the boost-build folder. /usr/share/boost-build
> The online docs are rarely useful to me except when I started.
I have found that folder already, but without documentation and without fully understanding the syntax its quite difficult to understand these files.

>> Adding source files with the glob-tree feature works fine, but now I am
>> trying to do something similar for the includes, since otherwise the program
>> doesn't compile.
> I find it interesting you include everything in the form #include<...>
> for a single executable.
Sorry, I don't understand what you mean here.

> Generally using #include<...> is reserved for libraries. So in your
> code if you have a subdir that could constitute a unit of compilation
> you would add a Jamfile there and specify the library to be the
> contents of that folder. You could then specify a usage-requirement of
> "<include>." which will add that folder to the include search path for
> anyone who includes that library in another target.
> To include it in Jamroot you would use path/to/subdir//target
> I would also recommend using use-project in that case.
I have that already. There are multiple subfolder all representing one project each. Some of them are libraries and some are executables using these
libraries. They all share the same Jamroot file in their parent folder. Also the libraries already have defined a proper "usage-requirement". However
the executables themselves have a lot of header files spread through their source tree and without including these directories properly it doesn't
compile. I then get error messages that certain include files could not be found from the g++ compiler. So that was the reason why I was asking for a
way to automatically find and add all these folders to the includes.

Kind regards,
Thomas Bretgeld


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