[CMake] [Digital Signature Failure] Add a build event that depends on a target

Dvir Yitzchaki Dvir.Yitzchaki at ceva-dsp.com
Mon Nov 20 01:31:48 EST 2017


Try

add_dependencies(program test)

See https://cmake.org/cmake/help/latest/command/add_dependencies.html.

Regards,
Dvir

From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Pawel Veselov
Sent: Saturday, November 18, 2017 01:09
To: cmake at 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!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171120/f7d6b65d/attachment.html>


More information about the CMake mailing list