On Tue, Apr 27, 2010 at 15:50, Tyler Roscoe <ty...@cryptio.net> wrote: > On Tue, Apr 27, 2010 at 02:47:18PM +0100, Magnus Therning wrote: >> Except of course that it will take away one of the things I *really* >> want, which is that all unit tests are run every time I compile. > > We run our unit tests with a python wrapper script that does some > environment configuration before running the test. We then add this > script as a post_build custom command so that the unit test runs after > it compiles. > > add_custom_command (TARGET ${PROJECT_NAME} > POST_BUILD > # Call the runner script directly. By doing it this way, all the > # unit tests in the executable run at once. If we call CTest > # here (like we do for the _runtest target), the script (and > # thus the python interpreter) is invoked once for each test in > # the executable, which is slower than calling the script once. > COMMAND ${PYTHON_EXECUTABLE} ${${PROJECT_NAME}_TESTRUNNER} > ${CMAKE_CFG_INTDIR} --gtest_print_time > )
That does what I want, thanks for that tip. One thing though, it seems the command is run *always* irrespective of whether the target is built or not. That doesn't seem to square up with the text in the man page: The command becomes part of the target and will only execute when the target itself is built. If the target is already built, the command will not execute. /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe _______________________________________________ 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