[CMake] "cmake --build ." and colors
Gregoire Aujay
gaujay at movea.com
Fri May 17 12:59:19 EDT 2013
Hello,
Ok tell me if I am wrong but what you're saying is that it is possible to enable a pass-thru mode for cmake --build but currently it is not implementer?
Meanwhile I finally found a workaround using the "build_command" Command that I did not see before: http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:build_command
During CMake phase I can output all the build commands I want:
- one with "all" target
- the other one with @_target_@ so I configure it later
Then I use these files to build my .bat / .sh that I can launch.
I seems to work fine, I have my colors and my compact ninja output. But now with MSVC_IDE the output is disabled, I can live with that for now :)
Regards,
Gregoire
-----Original Message-----
From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of Brad King
Sent: vendredi 17 mai 2013 17:43
To: Leif Walsh
Cc: cmake at cmake.org; Andreas Mohr
Subject: Re: [CMake] "cmake --build ." and colors
On 05/04/2013 08:12 AM, Leif Walsh wrote:
> 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.
This is correct, but it doesn't have to be so. In the case of a direct "cmake --build ..." invocation from a terminal CMake is not doing any special logging so it should be able to share its host terminal such that isatty() returns true for the underlying tools.
The "cmake --build ..." implementation ultimately runs through the cmSystemTools::RunSingleCommand code path:
http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmSystemTools.cxx;hb=v2.8.11#l615
in order to invoke the native build command. One could add an option to that code path to share the output pipes with the cmake process just like "ctest --launch" does in pass-thru mode:
http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/CTest/cmCTestLaunch.cxx;hb=v2.8.11#l221
cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDOUT, 1); cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDERR, 1);
One could then activate that from the "cmake --build" call site by passing the option through all the intermediate levels of the call stack (cmake::Build and cmGlobalGenerator::Build IIRC).
-Brad
--
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
More information about the CMake
mailing list