[Scons-users] Export command and CPPPATH concatenation

Dirk Bächle tshortik at gmx.de
Sat Feb 1 04:43:16 EST 2014

On 01.02.2014 09:51, Laurent wrote:

> Hi Dirk,


> Le 31 janv. 2014 à 23:12, Dirk Bächle <tshortik at gmx.de

> <mailto:tshortik at gmx.de>> a écrit :


>> [...]


> No, I never try to add ‘./A’ to CPPPATH, this is why I am concerned. I

> can send you this example by mail. I don’t know if I can add it to the

> user mailing list so I did not provided it.


> The SConstruct and SConscript files provided in the mail are complete

> (except for the missing ‘)’ in the SConstruct). From the example you

> can see that adding './A’ to the CPPPATH is not necessary (no include

> file in this directory). So I did not do it. Scons is automatically

> adding ‘./A’ to the CPPPATH which I find rather strange.


Thanks for checking your input files again. I saw the missing ')' too,
so I wasn't sure about whether your set of input files would be complete
or not.

What is happening is that you specify the CPPPATH variable in the
top-level SConstruct. But it gets evaluated during the call to
StaticLibrary in the subfolder "A". Based on SCons' hierarchical build
style, filenames and paths get interpreted relative to the current
directory. That's why the "A" folder gets prepended to your path a
second time, and this is normal and wanted behaviour.

To get around this, please either

- change your CPPPATH to a simple "./B", or
- use the "absolute path" specifier "#A/B".

My preferred method for the first option is to export the environment
as-is to my SConscripts, and create a shallow Clone() copy where I
add include or library paths locally. This is less confusing, and makes
it easier to move complete source folders around or rename them.

Hope this helps,


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20140201/feb1b672/attachment.htm

More information about the Scons-users mailing list