Add an include path for a single file in a library

140 views Asked by At

I'm building a library for which one file requires an additional include path. Is there a way to adjust the include path for compilation of a single file?

     bld(features="cxx cxxshlib",
         source=[so, many, files, from an ant_glob],
         includes=[Some path that's really only needed for one interface file])

I'd be happy with a solution that is use based, too.

2

There are 2 answers

0
Inkrementator On

I think most solutions will be more lines of code than just compiling your one file separately.

2
user69453 On

You need to compile the specfic file by using objects and then use the result.

Something like this:

def build(bld):
    # build the specfifc object
    bld.objects(source="foo.cpp", includess="path/to/directory", target="foo")
    # build the library and include that object file using 'use='
    bld.stlib(source='bla.cpp blu.cpp', includes="this/path that/path", target='mylibrary', use='foo')