Boost logo

Boost-Build :

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


Hi,

is there a way to recursively add all subdirectories of a given path to the list of inlude paths for a target? I am pretty new to boost.build and
couldn't find any documentation or examples for this problem online.
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. Correct me, if I am wrong, but it looks like there is no built-in feature that does this. I think that what I need is a rule that
takes the path to search and an exclude pattern (e.g. to exclude ".svn" directories) and then generates a list of all matching subdirectories and adds
each entry to the list of includes. However, I have no idea on how to do this. Any help?

Kind regards,
Thomas Bretgeld

Jamroot:
--------
#Other libraries
lib librt : : <name>rt ;

#Global project settings that apply to all sub-projects
project bla
: requirements
     <tag>@build-tag-rule
: default-build
     <warnings>all
     release
# debug
: build-dir
     build
;

#Generator rule that adds the <variant> setting to the filename
#e.g. "_release" or "_debug"
import virtual-target ;
rule build-tag-rule ( name : type ? : property-set )
{
   if $(type) = EXE
   {
     suffix = [ $(property-set).get <variant> ] ;
     return [ virtual-target.add-prefix-and-suffix $(name)_$(suffix) : $(type) : $(property-set) ] ;
   }
}

Jamfile:
--------
exe Test :
#Sources
  [ glob-tree *.h *.cpp *.c : .svn ]
  ..//librt
:
#Requirements and conditional requirements
  <include>.
#---------------
#Problem is here
#---------------
  <include>???
:
#Default build properties
:
#Usage Requirements
;


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