Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set options in SConstruct for C compiler depending on compiler type?

I need to set additional options for C compiler, e.g. add flag to turn all warnings ON, depending on the type of the compiler. E.g. for MSVC I should use

env.Append(CPPFLAGS = "/Wall")

but for mingw (gcc) I need to use:

env.Append(CCFLAGS = "-Wall") 

How can I do this in scons way?

like image 220
bialix Avatar asked Dec 25 '09 13:12

bialix


1 Answers

You could just check for the name of the compiler:

cc = env['CC']
if cc == 'cl':
  env.Append(CPPFLAGS = '/Wall')
elif cc == 'gcc':
  env.Append(CCFLAGS = '-Wall')
like image 109
richq Avatar answered Oct 20 '22 00:10

richq