tags:

views:

37

answers:

1

Hi folks, I have tried editing SConstruct to point to a different gcc compiler but it always seems to use the one defined in /usr/bin/gcc and /usr/bin/g++.

env = DefaultEnvironment()
env['CC'] = '/home/aaron/devel/bin/gcc'
env['CXX'] = '/home/aaron/devel/bin/g++'

What am I doing wrong? Also, is there a way to specify a different compiler on the command line using something like:

scons cxx=/home/aaron/devel/bin/g++

I've gone crazy trying to make this work. Thanks!

Daze

+1  A: 

Have you tried the advice given in the SCons wiki? For your case, that would be

path = ['/path/to/other/compiler/bin', '/bin', '/usr/bin',]
env = Environment(ENV = {'PATH' : path})

i.e., make your own environment with exactly the content you want, such as the $PATH (other bits of useful advice about environments are close by in the same wiki page).

To add your own options to scons' command line, per the docs, you should be able to use AddOption, see section 12.1.5 (but, I have not tried this one myself).

Alex Martelli
AddOption is the right way to do this. You can also use ARGUMENTS.get('cxx') but then that is not sticky.
cheez