[CMake] Capturing/processing output of the ADD_TEST command
david.cole at kitware.com
Wed Jul 28 12:15:12 EDT 2010
The easiest way to separate output is to wrap your test in a cmake -P
script, and then inside that call execute_process to run the "real test" and
use its facilities to capture output into variables or redirect output to
There is no redirection of output using add_test arguments.
On Wed, Jul 28, 2010 at 12:01 PM, Emmanuel Blot <eblot.ml at gmail.com> wrote:
> I'd like to run some static analysis tool from CTest. (2.8.1)
> I've added enable_testing() and add_test() calls in my CMakeLists.txt
> file, and the static analysis tool is invoked as expected, however:
> * CTest discards both the tool standard output and tool standard
> error stream when ran with no option, which makes the purpose of the
> analysis useless;
> * CTest preserves both tool stream outputs when run with the -V
> option, but add its own output messages to the resulting info, which
> makes the analysis output nearly impossible to read.
> 1/ Is it possible to keep the standard error stream from the tool and
> to discard CTest ouput and the tool's stdout ?
> 2/ It does not seem CTest follows the same convention as CMake's
> ADD_CUSTOM_COMMAND which accepts an 'ARGS' argument and stream
> redirection (using '>'). What's the equivalent syntax in CTest?
> Powered by www.kitware.com
> Visit other Kitware open-source projects at
> Please keep messages on-topic and check the CMake FAQ at:
> Follow this link to subscribe/unsubscribe:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the CMake