Getting FileCheck's colored output through lit (& possibly ninja)

So I manage to get clang's colored output through ninja simply by
force (CMAKE_CXX_FLAGS=-fcolor-diagnostics), which isn't ideal (if I
were to pipe ninja's output to a file it'd still have color escapes,
etc) but it works.

But I haven't found a similar solution for FileCheck & I'm wondering
has anyone already solved this problem for themselves - if so, how?

if not, how should we solve this problem?

Some strawmen:

Introduce a flag to FileCheck to force colors on. Have lit pass this
when lit detects it's wired to a color-compatible terminal (this still
wouldn't work for the ninja build - either special case that, or get
upstream fixes to have ninja pretend to be a color-compatible
terminal?). How/where do we pass the flag, then? Would that require
replacing every FileCheck usage with %FileCheck and having lit do the
replacement? Or are there less intrusive alias options?

If ninja can be taught to pretend to be color-compatible, then perhaps
lit can do the same thing. In that case FileCheck would need no
modifications.

Just a quick note: lit is already replacing all LLVM tool names instead
of relying on $PATH (see test/lit.cfg). This could easily be adapted to
add a flag for FileCheck.

-Nico

Let's not do that. A % substitution is the right way to define some
standard set of flags (e.g. %clang_cc1). I find the path-insertion
hack useful for other reasons, but it's a hack.
--paulr