[CMake] Problem with testing with cmake

ankit jain ankitguddu at gmail.com
Wed Feb 18 05:31:26 EST 2009

Hi all,

I have a directory structure with follwoign cmakelist as:



Contents of Cmakelist of subfolder:

add_executable(myfile myfile.cpp)
target_link_libraries(myfile mylib)
add_test(t1 myfile)

t1 is the test case defined in myfile.cpp whose executable i have made.

Contents of Camkelist of myfolder:


Now when i am running make test from the myfolder directory on the prompt it
says test failed and saying error with ctest.

Iam not able to know whether my way of testing is right or not. i am sure
that it is wrong but dont know where.

Can anybody tell me where iam wrong. I reasd the documentation realted to
add_test and ctest but not getting proper example to clear my doubts.

Apart from that i more thing i want to know is that the name of the test  we
are giving in add_test() command as its first argument is the name of the
test that is defined in the executable which we have made.

Since iam using it first time iam not clear about all these and
documentationdoes nto clearify my doubts.

I request if anybody give me an example or whatever ia haev given to tell me
the right way of testing through cmake.

Any suggestion  in this will be really a great help for me.

Any further information if required that i am missing plz let me know.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090218/8f60cfae/attachment.htm>

More information about the CMake mailing list