[CMake] No Color Output With "cmake --build" in CMake 2.8

Brad King brad.king at kitware.com
Thu Dec 17 14:56:29 EST 2009


Eskandar Ensafi wrote:
> When I use the Unix Makefile generator (or the NMake Makefile generator
> under Windows), running “cmake --build <bindir>”  does not produce color
> output, whereas “cd <bindir> && make” does.  Is there a reason for this,
> or have I stumbled upon a bug?

The color output auto-detects whether it is attached to an interactive
terminal (tty).  If not, it does not print the escapes.  When cmake
runs the "make" command through --build, it hands the process a new
pipe and not its own stdout (which might be a tty).

The --build option is meant for scripts to drive builds and log output
to a file, so no color is desired.  I would consider interactive use
of --build to be a feature request.  Its implementation re-uses some
of the automated build command invocation used by CTest's ctest_build
command.  Adding a pass-thru to the outer process's pipe is somewhat
tricky.

-Brad


More information about the CMake mailing list