[CMake] Emit compile line on compilation error

Eric Noulard eric.noulard at gmail.com
Mon Oct 19 16:04:12 EDT 2009


2009/10/19 Bill Hoffman <bill.hoffman at kitware.com>:
> K. Noel Belcourt wrote:
>>
>> Hi,
>>
>> Is there an easy way to have CMake emit the compile line only if a compile
>> error occurs?  We prefer to build with VERBOSE output off and were looking
>> for a cleaner way to emit diagnostics.
>>
>> Anyone know if this is possible?
>>
>
> This is not possible with CMake right now.

An ugly way to do it on Unix platform would be:

$ make VERBOSE=1 > compile.out

this will print the error on stderr (if any)

then
$ tail compile.out | grep -A1 "\\[.*%"

will give you the last failiing compile line.

if you want to keep the progress report, you may enhance the first command with:

$ make VERBOSE=1 | tee compile.out | grep "\\[.*%\\]"

I assumed you were on Unix + Makefile + command line and this
is just a trick waiting for your may-be feature request to be may-be
implemented :-)

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list