[CMake] How to redirect the output of an executable while testing

Mathieu Malaterre mathieu.malaterre at gmail.com
Mon Feb 23 10:31:01 EST 2009


On Mon, Feb 23, 2009 at 1:46 PM, ankit jain <ankitguddu at gmail.com> wrote:
> Hi all,
>
> I have an executable having some test cases. I want to give some arguments
> to it which i will give it through  add_test command. but my objective is to
> write the output of the executable to a file at run tiem itself.
>
> How to do that?

The simpliest solution would be to rewrite the test itself ...

> Secondly i want ot use this file in which output of executable is written as
> an argument to other test case.
>
> How to achieve that?

You could just wrap the test within a cmake -P call where the cmake
script would call execute_process. Check the execute_process to see
how to retrieve stderr/stdout.

2cts
-- 
Mathieu


More information about the CMake mailing list