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

Pawel Veselov pawel.veselov at gmail.com
Mon Nov 20 06:35:23 EST 2017


Hi Dvir,

On Mon, Nov 20, 2017 at 7:31 AM, Dvir Yitzchaki <Dvir.Yitzchaki at 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-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/499628ea/attachment-0001.html>


More information about the CMake mailing list