Hi.

Is it possible in some way to add a build event that depends on a target
(different target than what the build event is for)? add_custom_command()
doesn't seem to support that.

What I'm trying to do is:
1) Have target "test", which builds tests
2) Have target "program". Have a post-build build event
   that executes test, so that the program is only
   fully built when the tests are successful

Simple:
------ cut ------
add_executable(test test.c)
add_executable(program program.c)
enable_testing()
add_test(NAME test COMMAND test)
add_custom_command(
  TARGET program
  POST_BUILD
  COMMAND ${CMAKE_CTEST_COMMAND} -R test
)
------ cut ------

doesn't work, at least in parallel build, there is nothing that prevents
the unit test to run before test is built (which is what happens).

Thank you!
-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to