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

1

5

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?

Koonce answered 25/12, 2009 at 13:25 Comment(0)
D
6

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')
Delegation answered 26/12, 2009 at 16:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.