[prev in list] [next in list] [prev in thread] [next in thread]
List: cmake
Subject: Re: [CMake] pipe add_test() output into a file
From: Nico_Schlömer <nico.schloemer () gmail ! com>
Date: 2014-08-26 13:17:28
Message-ID: CAK6Z60daV47EtwUFpqODDCrByR92sxcGvZ8ck6eD+bj6g9_eKg () mail ! gmail ! com
[Download RAW message or body]
Thanks Nils! That does the trick.
--Nico
On Tue, Aug 26, 2014 at 12:03 PM, Nils Gladitz <nilsgladitz@gmail.com> wrote:
> On 08/26/2014 11:50 AM, Nico Schlömer wrote:
> >
> > I would like to add a test for a file converter. The output of the
> > converter is written out to stdout, and I would like to direct this
> > into a file to compare it against a reference file. The signature of
> > add_test() [1] however doesn't seem to allow that.
> >
> > How would you go about this problem?
>
>
> You could run cmake in script mode (${CMAKE_COMMAND} -P) and have the script
> call your converter with execute_process().
>
> You can pass the path to the converter with the $<TARGET_FILE:tgt> generator
> expression and -D (-D options have to be listed before -P).
>
> Note that generator expressions in tests are only supported when the test is
> defined with the NAME/COMMAND signature of add_test().
>
> execute_process() can capture the output of the command in a file or
> variable.
>
> The script could then also perform the comparison.
>
> You can make the script (and the test) fail with e.g. message(FATAL_ERROR
> "message")
>
> Nils
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at: \
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more information \
on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at \
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic