murtiko
(Murtiko)
July 19, 2023, 9:13am
1
Hi,
How can I enable color output when using the Ninja generator?
I have set CMAKE_COLOR_DIAGNOSTICS
to ON and also tried adding the -fdiagnostics-color=always
compiler option, but still, no color is displayed.
The color output works fine when I use the make generator. Is there a way to get colored output when using the Ninja generator?
ben.boeckel
(Ben Boeckel (Kitware))
July 19, 2023, 10:15am
2
Ninja buffers output, so tools are writing to a pipe, not directly to the terminal, so auto-detection may turn it off conservatively. Does make -Otarget
still work (this does similar buffering)?
murtiko
(Murtiko)
July 19, 2023, 11:09am
3
Yes, make -Otarget
displays colored output when the project configured with Make.
So is it expected to get color with Ninja then?
ben.boeckel
(Ben Boeckel (Kitware))
July 19, 2023, 11:33pm
4
I’m not sure…I’ve never used color diagnostics myself (NeoVim tends to re-color build output anyways AFAICT).