Let's keep this on the list in case it helps someone else. On Fri, May 07, 2010 at 10:27:16PM +0100, Magnus Therning wrote: > On 07/05/10 17:24, Tyler Roscoe wrote: > > On Fri, May 07, 2010 at 04:41:23PM +0100, Magnus Therning wrote: > >>> 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 > >>> ) > >> > >> 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: > > > > Works For Me. I only see unit test runs if the library in question is > > recompiled or relinked. What version of CMake are you using? > > 2.8 > > What kind of target is ${PROJECT_NAME}? > > I used a target created with add_custom_target, so maybe that's the cause of > it.
I think all the targets in our project which use this post-build step are libraries or executables. If your target is a custom_target that always runs (which, as noted in the docs, custom_targets sometimes do) then of course the post-build step will also always run. hth, tyler _______________________________________________ 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