[CMake] RUN_TESTS project & dependencies

Marcel Loose loose at astron.nl
Fri Mar 20 10:33:04 EDT 2009


Hi Robert,

I am planning to use (but haven't implemented and tried yet):

- add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
  to define a custom 'check' target (as with GNU Autotools)

- add_executable(<testprog> EXCLUDE_FROM_ALL ...)
  for each test program

- add_dependencies(check <testprog>)
  for each <testprog> you want to be compiled, linked and run

Hope it helps.

Marcel Loose.

On Fri, 2009-03-20 at 13:47 +0100, Eric Noulard wrote:
> 2009/3/20 Philip Lowman <philip at yhbt.com>:
> > On Thu, Mar 19, 2009 at 12:35 AM, Robert Dailey <rcdailey at gmail.com> wrote:
> >>
> >> Hi,
> >>
> >> I'm currently using Visual Studio 2008 and CMake v2.6.3. I noticed that
> >> when I create unit tests, they are not added as dependencies in the solution
> >> containing all of the unit test projects + the RUN_TESTS project. For
> >> example, when I change one of the source files in a particular unit test
> >> project, running RUN_TESTS will still run the old tests and not force them
> >> to rebuild. If RUN_TESTS had a dependency on all unit tests in the solution
> >> this problem would be solved. Is there a way to set this up? If not, why is
> >> this behavior not supported?
> >
> > This would be a nice thing to have.  I had someone complain at work the
> > other day that they had to run "make" before "make test" as well.  Seems
> > like CMake should add the dependency to the test target as add_test() is
> > being called.
> 
> You may have a look at another thread on the ML
> that is pursuing a similar issue;
> 
> http://www.cmake.org/pipermail/cmake/2009-March/027929.html
> 
> >
> > Have you filed a feature request yet for this?  Is there already one?
> >
> 
> 



More information about the CMake mailing list