如何设置选项SConstruct为根据编译器类型C编译器? [英] How can I set options in SConstruct for C compiler depending on compiler type?
本文介绍了如何设置选项SConstruct为根据编译器类型C编译器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要为C编译器,例如附加选项添加标志来打开所有的警告,这取决于编译器的类型。例如。对于MSVC我应该使用
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")
但MinGW的(GCC)我需要使用:
but for mingw (gcc) I need to use:
env.Append(CCFLAGS = "-Wall")
我怎样才能做到这一点scons的方式?
How can I do this in scons way?
推荐答案
您可以只检查编译器的名称:
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')
这篇关于如何设置选项SConstruct为根据编译器类型C编译器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文