Hi Dvir, On Mon, Nov 20, 2017 at 7:31 AM, Dvir Yitzchaki <dvir.yitzch...@ceva-dsp.com > wrote:
> Try > > > > add_dependencies(program test) > Thank you! That helped. > > > See https://cmake.org/cmake/help/latest/command/add_dependencies.html. > > > > Regards, > > Dvir > > > > *From:* CMake [mailto:cmake-boun...@cmake.org] *On Behalf Of *Pawel > Veselov > *Sent:* Saturday, November 18, 2017 01:09 > *To:* cmake@cmake.org > *Subject:* [Digital Signature Failure] [CMake] Add a build event that > depends on a target > > > > 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