[CMake] Running tests as part of a build

Gavin Heavyside gavin.heavyside at gmail.com
Fri Jan 8 13:10:23 EST 2010


I am seriously looking at moving the build system of some existing software
from scons to cmake.  Most things I want to accomplish seem easier in cmake,
but there is one thing I can't work out how to do.

I like to have (at least some) unit test run as part of the build, e.g. when
I type 'make' then my program compiles, the tests compile and then the tests
run.  This means that failing tests are equivalent to a failing build, and
stops me 'forgetting' to run 'make test'.

I can generate my tests and and have them added to the 'test' target easily
enough, and 'make test' works fine.  Is there a straightforward way to run
tests after they are built as part of 'make' on its own, and have a failing
test cause a build failure?

I'm using g++ on linux & mac and Google Test as my unit testing framework,
in case it make a difference to the answer.

Thanks very much,

Gavin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100108/8cb045a0/attachment-0001.htm>


More information about the CMake mailing list