[CMake] Unit tests, but not CTest

Tyler Roscoe tyler at cryptio.net
Fri May 7 12:24:13 EDT 2010


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?

tyler


More information about the CMake mailing list