views:

51

answers:

2

in dirA/SConscript I have:

Import('env')
probeenv = env.Clone()
probeenv['CXXFLAGS'] +=  ['-fno-rtti','-Wnon-virtual-dtor']
... stuff that uses probeenv

in dirB/SConscript I have

Import('env')
sipenv = env.Clone()
... stuff that uses sipenv

Now, c++ files in dirB that gets compiled, gets the CXXFLAGS from dirA - how come ? This does not happen with CCFLAGS. Nor does it happen if I use probeenv['CXXFLAGS'] = ['-fno-rtti','-Wnon-virtual-dtor'] in dirA

+1  A: 

There is dedicated method to append data to various compiler flags:

probenv.Append(CXXFLAGS = ['-fno-rtti','-Wnon-virtual-dtor'])

There is also AppendUnique and AppendENVPath. See the man for description.

bialix
A: 

This seems to be a scons bug if CXXFLAGS is not set in "main" SConstruct. The workaround is to simply set it to an empty list there.

SConscript:

env['CXXFLAGS'] = []
leeeroy