[CMake] Tests without CTest (was Re: Custom target bug...)

Marcel Loose loose at astron.nl
Thu Aug 20 04:22:31 EDT 2009


On Wed, 2009-08-19 at 21:20 -0700, Tim Kientzle wrote:
> David Cole wrote:
> > You're using incorrect arguments as DEPENDS. Things that follow DEPENDS 
> > should be full path file names... not cmake target names.
> 
> Okay, I think I finally figured out how to do what I need (which is,
> of course, to run custom test code without using CTest):
> 
>    # CMakeLists.txt
>    PROJECT(foobar C)
>    ADD_CUSTOM_TARGET(run_all_tests)
>    ADD_SUBDIRECTORY(foo)
> 
>    # foo_test/CMakeLists.txt
>    ADD_EXECUTABLE(foo_test foo_test.c)
>    ADD_CUSTOM_TARGET(run_foo_test COMMAND foo_test)
>    ADD_DEPENDENCIES(run_all_tests run_foo_test)
> 
> With this, I can easily add other subdirectories with
> their own test code and build up run_all_tests
> conditionally depending on which modules are enabled.
> 
> I recall someone else asked this list recently about
> using DejaGNU tests with CMake; I believe this approach
> should work for that as well.
> 
> Cheers,
> 
> Tim

Hi Tim,

Did you read this http://www.cmake.org/Wiki/CMakeEmulateMakeCheck Wiki
page and this http://www.mail-archive.com/cmake@cmake.org/msg19936.html
thread on the mailing list?

Best regards,
Marcel Loose.




More information about the CMake mailing list