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

2009-08-19 Thread Tim Kientzle

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
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


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

2009-08-20 Thread Marcel Loose
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.


___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake