[CMake] Quick Question: add_custom_target( xxx ) add_custom_command( TARGET xxx ... )

J Decker d3ck0r at gmail.com
Mon Mar 10 18:48:33 EDT 2014


*shrug* there's no build targets... it's just a
update/package/uninstall/install script for android apk targets...
Turned out to work pretty good other than...

configure_file() I had to emit a 1 line script and call 'cmake -P
StupidConfigure.cmake'

FILE(GLOB) didn't work because the targets weren't in place...

Any of the phases will be fine for me..... and adding the custom commands
to the custom target works well.  I didn't include their own output
dependancies; but the result is a script that updates and packages much
faster than the old cmake script :)

All of the examples I searched for eluded to the same solution as you...
which is why I thought it couldn't be as simple as it is (my issues was
that I didn't update the TARGET name correctly in the added commands;
changed the custom target and forgot to update the rest)


On Mon, Mar 10, 2014 at 11:15 AM, Matthew Woehlke <
mw_triad at users.sourceforge.net> wrote:

> On 2014-03-10 02:55, J Decker wrote:
>
>> add_custom_target( xxx )
>> add_custom_command( TARGET xxx
>>     (PREBUILD? POSTBUILD? PRELINK?)
>> COMMAND blah )
>>
>
> This doesn't make sense; a custom target doesn't have build/link/etc.
> steps.
>
> The usual way to do this is:
>
> add_custom_command(OUTPUT x.y ...)
> add_custom_target(xxx DEPENDS x.y ...)
>
> ...which anyway more correctly expresses the individual file dependencies,
> e.g. foo -> foo.in, bar -> bar.in, etc.... so if only foo.in changes,
> only the step for foo needs to execute.
>
>  EXECUTE( cmake copy_if_different )
>>
>
> Just so you know, this is much better done via configure_file :-). (Of
> course that won't be available when you switch to using custom commands,
> but...)
>
> --
> Matthew
>
> --
>
> 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://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140310/96ae3b9c/attachment.html>


More information about the CMake mailing list