<div dir="ltr">Hi.
<div><br></div><div>Is it possible in some way to add a build event that depends on a target</div><div>(different target than what the build event is for)? add_custom_command() </div><div>doesn't seem to support that.</div><div><br></div><div>What I'm trying to do is:</div><div>1) Have target "test", which builds tests</div><div>2) Have target "program". Have a post-build build event</div><div>   that executes test, so that the program is only</div><div>   fully built when the tests are successful</div><div><br></div><div>Simple:</div><div>------ cut ------</div><div>add_executable(test test.c)</div><div>add_executable(program program.c)</div><div>enable_testing()</div><div>add_test(NAME test COMMAND test)</div><div>add_custom_command(</div><div>  TARGET program </div><div>  POST_BUILD </div><div>  COMMAND ${CMAKE_CTEST_COMMAND} -R test</div><div>)</div><div><div>------ cut ------</div></div><div><br></div><div>doesn't work, at least in parallel build, there is nothing that prevents </div><div>the unit test to run before test is built (which is what happens).</div><div><br></div><div>Thank you!</div><div><br></div></div>