Why doesn't clang show color output under Scons?

最后都变了- 提交于 2019-12-31 09:22:31

问题


When building with Scons, I can configure it to use clang like so:

env["CXX"] = "clang++"

However, it doesn't seem to preserve the color information that clang outputs. How can I make scons preserve the color?


回答1:


According to the clang documentation, color is enabled only when a color-capable terminal is detected. SCons doesn't automatically pass on all environment variables to the process that runs the compiler, you have pass them explicitly. And TERM is not passed on to clang.

Add the following to your SConstruct and color should work again:

import os
env['ENV']['TERM'] = os.environ['TERM']


来源:https://stackoverflow.com/questions/9922521/why-doesnt-clang-show-color-output-under-scons

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!