On 06/14/2011 11:46 AM, Michael Wild wrote: > On 06/14/2011 11:36 AM, Sebastian Schaetz wrote: >> Hi, >> >> I'm using CMake to generate makefiles to build my C++ projects with g++. When >> developing code I find it useful to "post-process" g++ output. In particular >> I >> like to feed the output through gSTLFilt.pl [0] and a custom version of >> colorgcc >> [1]. >> >> Currently I have a wrapper around make (I call xmake.sh) that pipes the >> entire >> output of make through those two tools [2]. But this is not optimal since I >> lose >> the colorful output CMake puts into the makefiles. >> >> So my question is: is there a way to append stuff to the g++ command line >> such >> as "2>&1 | perl colorize.pl 2>&1 | perl gSTLFilt.pl"? >> >> Thanks in advance, >> Sebastian >> >> [0] http://www.bdsoft.com/tools/stlfilt.html >> [1] http://schlueters.de/colorgcc.html >> [2] https://github.com/sschaetz/colorgcc/tree/filter > > I don't think that this is possible directly. But you can write a > wrapper shell script which does the above and then pass that script as > the compiler to cmake. Something like this: > > #!/bin/sh > /usr/bin/g++ $@ 2>&1 | perl colorize.pl 2>&1 | perl gSTLFilt.pl > > HTH > > Michael
Alternatively, you might use the RULE_LAUNCH_COMPILE properties to introduce a wrapper script for the compilations. In this way, you do not have to remember to configure the project with the wrapper script as compiler, and the script can't make any trouble during the initial CMake run when the toolchain is examined. However, when using a wrapper script in lieu of the compiler, be aware of the rules w.r.t. the return values of pipelines; Make is especially sensitive in this regard. E.g., just grepping GCC's output certainly wouldn't work, and the above-noted line means that the last Perl script's return value would be taken on trust. Refer to Bash's pipefail option for more information. 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