On Friday 08 January 2010 11:10:23 am Gavin Heavyside wrote: > 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. >
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 _______________________________________________ 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