[CMake] "cmake --build ." and colors

Leif Walsh leif.walsh at gmail.com
Sat May 4 08:12:14 EDT 2013


cmake --build . -- -jN


Extra args after -- are passed through to the build tool. Doesn't work if the tool expects something different though. 


I think the colors and carriage returns (without line feeds) are lost because the build tool sees its controlling terminal is cmake, not a real terminal program capable of showing color or redrawing, so it doesn't output them. Cmake may be logging this stuff too (to send to cdash for example) so this is kind of a responsible choice. 
-- 
Cheers,
Leif

On Sat, May 4, 2013 at 6:02 AM, Andreas Mohr <andi at lisas.de> wrote:

> Hi,
> On Fri, May 03, 2013 at 04:19:40PM -0400, cmake-request at cmake.org wrote:
>> Date: Fri, 3 May 2013 17:46:06 +0000
>> From: Gregoire Aujay <gaujay at movea.com>
>> Hello,
>> 
>> I also found that using cmake --build . with ninja outputs all lines but if I directly use ninja to build it only outputs one line which is very cool (it clears current line before printing the new one if there is no warning/error).
> Possibly that's both (colors, line clearing) related to ANSI color escape codes
> as used by the native build tool.
> It's perhaps possible to analyze where exactly the augmented output gets
> lost within the chain (doing analysis on source code side, of course).
> Probably some CMake handling or adopting of tool output filters out that markup.
>> I am wondering if there is any trick to enable colors when running this command:
>> cmake --build .
>> 
>> The only way I manage to get the colors is to directly use the make program, e.g.:
>> mingw32-make all
>> 
>> 
>> The issue is that I am trying to use a script that runs cmake to build instead of the make program that may change (ninja, mingw-make, make, msvc, etc).
> Yes, very much so. Dito for ninja and make here (and as launched by
> some cross-platform [ruby/python/perl] script).
> Somehow I failed to actively pick up that I could go through cmake --build .
> rather than grabbing ${CMAKE_BUILD_TOOL} (formerly ${CMAKE_MAKE_PROGRAM}) directly.
> Also, one might want to pass e.g. parallelization (make -jX) configuration through it
> as well, so it might be useful to devise a standard parameterization
> mechanism for --build to support *any* such attributes, in a generalized form.
> Andreas Mohr
> --
> Powered by www.kitware.com
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130504/aef27b4f/attachment.htm>


More information about the CMake mailing list