On 01/10/2012 07:17 PM, vivek goel wrote:
> Is there a way to color warning/error of gcc with cmake ?

AFAIK, no, but you might remember the power of *nix, feed the output
of "make VERBOSE=1 2>&1" into sed/awk/perl/<your-favorite-here> and
use ANSI Control Sequence Initiators:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(P C)
FILE(WRITE ${CMAKE_BINARY_DIR}/main.c "int main(void){Return 0;}\n")
SET_SOURCE_FILES_PROPERTIES(main.c PROPERTIES COMPILE_FLAGS "-Wall")
ADD_EXECUTABLE(main main.c)

% cmake <srcdir>
...
% make VERBOSE=1 2>&1 | sed \
-e 's%^.*: error: .*$%\x1b[37;41m&\x1b[m%' \
-e 's%^.*: warning: .*$%\x1b[30;43m&\x1b[m%'

Regards,

Michael
--

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

Reply via email to