[CMake] CTest Question

Scott Amort jsamort at gmail.com
Thu Jun 29 13:03:42 EDT 2006


Hi All,

I have one last hurdle in converting my project over to CMake - unit
testing.  I don't quite understand the CTest framework, and it doesn't
seem to be doing what I expect.  In my tests subdirectory, I have this
CMakeLists.txt:

#for testing
ENABLE_TESTING()

#build testing executables
ADD_EXECUTABLE(ExceptionTest ExceptionTest.cpp)

#add tests
ADD_TEST(exception_test ExceptionTest)

Currently, I generate various unit tests (using CxxTest) that result in
a series of .hpp and .cpp files in my tests subdirectory (e.g.
ExceptionTest).  With the older autotools setup, I could execute `make
check', which would then run these tests.  I expected that with CMake, I
could do a `make test' and get the same result, but it does not seem to
be working this way (although it does build and link the executable).
It would also be preferable that the testing sources aren't compiled
with the project sources, but only when a `make test' or equivalent
command is run.

Is CTest the right framework to be using?  Am I misunderstanding how to
use it?  There is not much documentation on the subject.

Thanks for any assistance!

Best,
Scott


More information about the CMake mailing list