如何设置scons系统包含路径 [英] How do I set scons system include path

查看:577
本文介绍了如何设置scons系统包含路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用scons我可以轻松设置我的包含路径:

Using scons I can easily set my include paths:

env.Append( CPPPATH=['foo'] )

这会传递标志

-Ifoo

至gcc

然而,我试图编译与许多警告启用。
特别是

However I'm trying to compile with a lot of warnings enabled. In particular with

env.Append( CPPFLAGS=['-Werror', '-Wall', '-Wextra'] )

在某些提升中可怕的包括...我可以通过添加boost包括到系统include路径而不是包含路径作为gcc treats系统包括不同。

which dies horribly on certain boost includes ... I can fix this by adding the boost includes to the system include path rather than the include path as gcc treats system includes differently.

所以我需要传递给gcc而不是-Ifoo是



So what I need to get passed to gcc instead of -Ifoo is

-isystem foo


$ b b

我想我可以用CPPFLAGS变量,但是想知道是否有更好的解决方案内置到scons。

I guess I could do this with the CPPFLAGS variable, but was wondering if there was a better solution built into scons.

推荐答案

SCons中没有内建的传递系统包含路径的方法,主要是因为它非常依赖于编译器/平台。

There is no built-in way to pass -isystem include paths in SCons, mainly because it is very compiler/platform specific.

将它放在CXXFLAGS中工作,但请注意,这将隐藏来自SCons的依赖性扫描器的头文件,它只查看CPPPATH。

Putting it in the CXXFLAGS will work, but note that this will hide the headers from SCons' dependency scanner, which only looks at CPPPATH.

如果你不希望这些头文件如果使用构建结果缓存和/或隐式依赖关系缓存,可能会导致奇怪的问题。

This is probably OK if you don't expect those headers to ever change, but could cause weird issues if you use the build results cache and/or implicit dependency cache.

这篇关于如何设置scons系统包含路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆