[Scons-users] Support of the isystem option for gcc

Paul Grégoire pg.ensiie at gmail.com
Tue Oct 14 09:37:31 EDT 2014


Hello,

I recently discovered SCons and I really think this is an amazing tool
for building software.

To build my project, I recently need to use "isystem" option of GCC.
This option is not currently supported by SCons. So I tried to
implement it with the help of Dirkbaechle
(http://stackoverflow.com/questions/25850762/scons-how-to-add-search-directories-to-an-existing-scanner).
Dirkbaechle suggested posting my solution here.

I have implemented the solution like this :


#### Add support for system headers
# declare and use a new PATH variable for system headers : CPPSYSTEMPATH
env['CPPSYSTEMPATH'] = []
env['SYSTEMINCPREFIX'] = '-isystem '
env['SYSTEMINCSUFFIX'] = ''
env['_CPPSYSTEMINCFLAGS'] = '$( ${_concat(SYSTEMINCPREFIX,
CPPSYSTEMPATH, SYSTEMINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)'
env['_CCCOMCOM'] += ' $_CPPSYSTEMINCFLAGS'
# add this variable to the C scanner search path
env['_CPPPATHS'] = ['$CPPPATH', '$CPPSYSTEMPATH']
setattr(SCons.Tool.CScanner, 'path_function',
SCons.Scanner.FindPathDirs('_CPPPATHS'))


And this can be used like this :

env.Append(CPPSYSTEMPATH = ["/usr/local/include/boost-1_55"])


I have added this peace of code directly in my SConstruct file, and I
do not know in which file I should add it in SCons. As far as I know
"isystem" flag is only a GCC flag and I do not know a MSVC equivalent
for instance.

I hope my solution will help people that meet this requirement, and if
I can help to introduce the code in SCons project, I would be pleased
to participate.

Best Regards,

Paul Grégoire


More information about the Scons-users mailing list