[CMake] Running tests as part of a build

Dmytro Ovdiienko dmitriy.ovdienko at gmail.com
Sun Jan 10 13:51:55 EST 2010


Gavin,

Good practice is to run as much tests as possible and do not stop on first
failed test.

2010/1/8 Gavin Heavyside <gavin.heavyside at gmail.com>

> Have you looked at add_custom_command(TARGET ...) or
>> add_custom_target(...)?
>>  Those are how you run can run commands as part of the build, but after
>> some
>> other targets are compiled.
>>
>> Clint
>>
>
> That works great, thanks for the tip!
>
> I build my code, and then my test programs using add_executable.  Then I
> can do e.g.:
>
> add_custom_command(TARGET test_harness POST_BUILD COMMAND test_harness)
>
> and test_harness runs after building, with proper dependencies, and a
> failing test causes a failing build.  Perfect.  Anything I don't want to run
> by default I can leave to add_test on its own.
>
> Thanks very much,
>
> Gavin
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100110/bb31f976/attachment.htm>


More information about the CMake mailing list