[CMake] post-installation tests

Brad King brad.king at kitware.com
Mon Sep 18 10:29:44 EDT 2006


Brandon J. Van Every wrote:
> I'm going up the Dart / CTest learning curve.  How am I supposed to
> implement tests that depend on my project already being installed? 
> Doing what I thought would be obvious, I found a way to crash
> CMakeSetup.  I've reported this as bug #3779. 
> ADD_DEPENDENCIES(post-install-action install) is not the magic.  What is?

The "install" target is not a first-class CMake target available at
project configuration time.  It is only created during the generation
step.  This may be fixed in the future but right now that's the way it's
implemented (probably because installation was supported only on UNIX in
ancient CMake days).

One way you can do this is to drive the installation itself as one of
the tests.  Tests are run in the order they are given with ADD_TEST
commands.  You can add a test that installs the project.  Other tests
can then reference the installed files.  If the installation fails it
will show up as a failed test.

You'll need to use "ctest --build-and-test" as the test command to drive
installation through the project's install target.  See the bottom of
this file for an example:

http://www.vtk.org/cgi-bin/viewcvs.cgi/Common/Testing/CMakeLists.txt?rev=1.37&view=markup

-Brad


More information about the CMake mailing list