MantisBT - CMake
View Issue Details
0015502CMakeCMakepublic2015-04-08 06:172016-06-10 14:31
trsystran 
Kitware Robot 
normalminoralways
closedmoved 
IntelUbuntu12.04
CMake 3.2.1 
 
0015502: Add color to Ninja output like with CMAKE_COLOR_MAKEFILE
With CMAKE_COLOR_MAKEFILE (default to ON) CMake creates target descriptions with colors.
This is great for human readability.

However, with the Ninja generator there is no such option, and CMake doesn't emit any color: the output is much harder to read by a human.

Would it be possible to add a CMAKE_COLOR_NINJA equivalent to CMAKE_COLOR_MAKEFILE, but for the Ninja generator?
No tags attached.
Issue History
2015-04-08 06:17trsystranNew Issue
2015-04-08 08:16Brad KingNote Added: 0038476
2015-04-08 08:38trsystranNote Added: 0038477
2015-04-08 08:45Brad KingNote Added: 0038478
2015-06-18 15:25Kyle J StrandNote Added: 0038950
2015-06-18 15:52Kyle J StrandNote Added: 0038951
2016-06-10 14:29Kitware RobotNote Added: 0042755
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0038476)
Brad King   
2015-04-08 08:16   
IIRC ninja captures the output of all tools in its own streams so they don't have access to the terminal. Therefore if someone works on this the feature would have to be enabled by some explicit option or environment variable.
(0038477)
trsystran   
2015-04-08 08:38   
According to this https://groups.google.com/forum/#!topic/ninja-build/YaoHVrHh5zk [^] CMake can use the "description" rule variable with ANSI escape codes.
(0038478)
Brad King   
2015-04-08 08:45   
Re 0015502:0038477: Neat. However this will still require an option to explicitly enable because CMake has no way to know at generation time what kind of terminal will be used to run ninja.
(0038950)
Kyle J Strand   
2015-06-18 15:25   
This should actually be achievable by adding the compile flag `-fdiagnostics-color=always`, according to the Ninja developers: https://github.com/martine/ninja/issues/814 [^]

I've tested this on Debian 7.8 using GCC 5.1.0, CMake 3.2.2, and Ninja 1.5.3. It should work for Clang as well, but I have not yet been able to verify this.
(0038951)
Kyle J Strand   
2015-06-18 15:52   
I've now tested it with a recent Clang++3.7 build from the LLVM trunk, as well, and it seems to work.
(0042755)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.