[CMake] Quick Question: add_custom_target( xxx ) add_custom_command( TARGET xxx ... )
Matthew Woehlke
mw_triad at users.sourceforge.net
Mon Mar 10 14:15:47 EDT 2014
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
More information about the CMake
mailing list