How do I set scons system include path

Michael Anderson picture Michael Anderson · Mar 14, 2010 · Viewed 18.1k times · Source

Using scons I can easily set my include paths:

env.Append( CPPPATH=['foo'] )

This passes the flag

-Ifoo

to gcc

However I'm trying to compile with a lot of warnings enabled. In particular with

env.Append( CPPFLAGS=['-Werror', '-Wall', '-Wextra'] )

which dies horribly on certain boost includes ... I can fix this by adding the boost includes to the system include path rather than the include path as gcc treats system includes differently.

So what I need to get passed to gcc instead of -Ifoo is

-isystem foo

I guess I could do this with the CPPFLAGS variable, but was wondering if there was a better solution built into scons.

Answer

BenG picture BenG · Mar 14, 2010

There is no built-in way to pass -isystem include paths in SCons, mainly because it is very compiler/platform specific.

Putting it in the CXXFLAGS will work, but note that this will hide the headers from SCons' dependency scanner, which only looks at CPPPATH.

This is probably OK if you don't expect those headers to ever change, but could cause weird issues if you use the build results cache and/or implicit dependency cache.