[CMake] add_custom_command, POST_BUILD

Vladimir Chebotarev vladimir.chebotarev at gmail.com
Thu Jun 2 15:17:30 EDT 2016


Hi.

The reason is to make build to fail as soon as possible if core library doesn't work properly. In C++ world that could be critical as hell because building process can last hours even on 32 cores.

And it will make CMake more ecological tool as it will reduce the energy wasted. :)

On Jun 1, 2016, Magnus Therning <magnus at therning.org> wrote:
>
>Vladimir Chebotarev <vladimir.chebotarev at gmail.com> writes:
>
>> Hi there.
>>
>> At the moment one can add a command executing after a build of a
>target
>> using:
>> add_custom_command(... POST_BUILD...)
>>
>> However if the command have a dependencies which build after the
>target,
>> there is practically no way to specify it.
>>
>> Simple case: we have a library and tests for it. E.g. I want them to
>run in
>> POST_BUILD of a library. But, tests already depends on the library so
>I
>> can't make them built before it.
>>
>> There are few possible solutions to that:
>> 1) add possibility to set dependencies for add_custom_command in
>POST_BUILD
>> mode;
>> 2) add possibility to populate list of targets if we have specified
>ones in
>> list.
>>
>> Or maybe correct me if I miss something.
>
>Have you not simply missed add_test()? ;)
>
>What's the reason for wanting the tests to run post-build, rather than
>on `make test`?
>
>/M

Kind regards,
Vladimir.


More information about the CMake mailing list