[CMake] Subset testing with CTest

Robert Dailey rcdailey.lists at gmail.com
Wed Sep 12 14:12:12 EDT 2012


The source repository at our company is structured for two products.
Both products have a large amount of shared targets, but there are
certain subdirectories in the tree that are product-specific. Each of
the product-specific targets have their own unit tests (and all common
targets have them as well).

When I want to build Product A, all I have to do is CD into product
A's subdirectory and initiate a build from there. I'd like a similar
feature for testing -- depending on which subdirectory we are in, we
can determine what to build, what to test.

I was looking over the information on the CMake wiki here:
http://cmake.org/Wiki/CMake/Testing_With_CTest

There is a section on specifying subsets. I can use regular
expressions or test indices, neither of which will work for our case.
There needs to be a way to specify tests for a single product.

Right now the only thing we can do is run "ctest -D Experimental" at
the root, but this builds and tests both products at once. I want to
be able to only build and test Product A. Can I do this now? Is there
some workaround I can use, or perhaps a feature I'm not aware of?


More information about the CMake mailing list