View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015789CMake(No Category)public2015-10-14 11:072016-03-07 09:12
ReporterJan Niklas Hasse 
Assigned ToBrad King 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionCMake 3.5Fixed in VersionCMake 3.5 
Summary0015789: Enable ANSI colors when CLICOLOR_FORCE is set to 1
DescriptionHi!

I have set up a build server which uses CMake and Makefiles on Windows using nmake. The build server pipes the output of both, so there's no colored output. But when I set the environment variable TERM to "xterm" nmake prints the messages like "Building xy" colored.

On my Linux build server this doesn't work however. I guess because the CMake generated Makefile checks if isatty returns true (which would mean the output isn't piped).

As there are situation where one wants to have colored output even if piped, it would be great, if CMake supported some kind of environment variable to force it on all platforms. As I was tired of all the different names, I've set up a page, which summarizes a possible standard name: http://bixense.com/clicolors/ [^]

What do you think about CMake to outputting ANSI colored text when CLICOLOR_FORCE is set to 1? Thanks :)
TagsNo tags attached.
Attached Filespatch file icon 0001-KWSys-Force-colored-output-when-CLICOLOR_FORCE-is-se.patch [^] (990 bytes) 2015-10-15 10:06 [Show Content]

 Relationships

  Notes
(0039600)
Brad King (manager)
2015-10-14 11:23

Yes, I think that makes sense. See the cmSystemTools::MakefileColorEcho method for an entry point into the code. Please read CONTRIBUTING.rst if you're interested in working on a patch.
(0039601)
Jan Niklas Hasse (reporter)
2015-10-14 11:29

Great! Thanks for the pointer, I will work on a patch in the next days :)
(0039616)
Jan Niklas Hasse (reporter)
2015-10-15 10:09

Patch is done, this was easier than I expected. Building and using a custom CMake worked like a charm! Kudos to you, contributing to CMake is fun :)
(0039617)
Brad King (manager)
2015-10-15 10:35
edited on: 2015-10-15 10:35

The patch modifies code in KWSys which has its own upstream separate from CMake. I've made the change over there:

 http://review.source.kitware.com/20280 [^]

based on your patch. I modified the logic a bit to conform to CLICOLOR_FORCE != 0 instead of CLICOLOR_FORCE == 1, as mentioned at http://bixense.com/clicolors/ [^] .

(0039628)
Brad King (manager)
2015-10-19 09:18

The change is now in KWSys upstream. I've integrated it into CMake here:

 KWSys 2015-10-16 (a7e5360f)
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9c6a7203 [^]
(0039630)
Jan Niklas Hasse (reporter)
2015-10-19 10:28

Thanks! :)
(0040622)
Robert Maynard (manager)
2016-03-07 09:12

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-10-14 11:07 Jan Niklas Hasse New Issue
2015-10-14 11:23 Brad King Note Added: 0039600
2015-10-14 11:29 Jan Niklas Hasse Note Added: 0039601
2015-10-15 10:06 Jan Niklas Hasse File Added: 0001-KWSys-Force-colored-output-when-CLICOLOR_FORCE-is-se.patch
2015-10-15 10:09 Jan Niklas Hasse Note Added: 0039616
2015-10-15 10:35 Brad King Note Added: 0039617
2015-10-15 10:35 Brad King Note Edited: 0039617
2015-10-19 09:18 Brad King Note Added: 0039628
2015-10-19 09:18 Brad King Assigned To => Brad King
2015-10-19 09:18 Brad King Status new => resolved
2015-10-19 09:18 Brad King Resolution open => fixed
2015-10-19 09:18 Brad King Fixed in Version => CMake 3.5
2015-10-19 09:18 Brad King Target Version => CMake 3.5
2015-10-19 10:28 Jan Niklas Hasse Note Added: 0039630
2016-03-07 09:12 Robert Maynard Note Added: 0040622
2016-03-07 09:12 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team