Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't clang show color output under Scons?

Tags:

c++

clang

scons

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?

like image 633
Verhogen Avatar asked Mar 29 '12 09:03

Verhogen


1 Answers

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']
like image 123
richq Avatar answered Oct 28 '22 23:10

richq