[CMake] Question about ADD_CUSTOM_COMMAND

Michael Hertling mhertling at online.de
Sat Feb 12 23:34:19 EST 2011


On 02/12/2011 03:00 PM, Carminati Federico wrote:
> Dear All,
>     I have a question about ADD_CUSTOM_COMMAND. I read in the doc
> 
> "If DEPENDS specifies any target (created by an ADD_* command) a target-level dependency is created to make sure the target is built before any target using this custom command. Additionally, if the target is an executable or library a file-level dependency is created to cause the custom command to re-run whenever the target is recompiled."
> 
> However if I add to the DEPENDS list a target built with ADD_CUSTOM_TARGET, first the target is correctly scanned and built, then make crashes because it considers it also a file dependencies and looks for a file with the same name of the target. Is this the normal behaviour? I can fix it with
> 
> ADD_CUSTOM_TARGET(all-todo COMMAND touch all-todo)
> ADD_CUSTOM_COMMAND(OUTPUT ... COMMAND ... DEPENDS all-todo ....)

See http://public.kitware.com/Bug/view.php?id=11332#c22532.

This should be fixed in CMake 2.8.4.

Regards,

Michael


More information about the CMake mailing list