问题
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