[CMake] add_custom_target and output file dependencies

Clifford Yapp cliffyapp at gmail.com
Thu Feb 10 10:40:33 EST 2011


I'm seeing an extremely strange behavior with
add_custom_command/add_custom_target, and I'm not sure what's causing
it.

Background:  I'm trying to copy large numbers of files in batch lots
during the make process, with a custom target that depends on a list
of files and runs a single copy process (cmake -P file.cmake where
file.cmake contains the list and the FILE(COPY command) to copy them
all in one gulp if any of them changes.

This works, but some of the copy processes do not terminate (i.e.
multiple calls to make result in the copy happening each time, even
though the files have already been copied.)  The termination failures
appear to be consistent, but for the life of me I can't figure out
what is causing them.  I have a list:

SET(tclscripts_TCLSCRIPTS
   ami.tcl
   ampi.tcl
   cad_clrpick.tcl
   cad_dialog.tcl
   chkexterns.tcl
   fs_dialog.tk
   helpcomm.tcl
   helplib.tcl
   hoc.tcl
   html_library.tcl
   libdm.tcl
   menu_override.tcl
   mouse.tcl
   vmath.tcl
)

This list fails every time to terminate.  However, if I comment out
either the first or the second entry (but NOT other entries, although
my testing has not been exhaustive) it DOES terminate.  There is
nothing special about either of the two first files that I can
discover.  Also, if I comment out one of those two and add another
file, the termination failure returns.

It's not terribly critical, but it is rather disturbing that these
copy commands keep getting run when I can't see any reason for it.
Has anybody seen behavior like this?  How would I check what is
triggering the copy?  I can try to cook up a more minimal test case if
there is a need, but it's difficult to be sure I can reproduce it in a
contained test because I don't know for sure what's happening.  Any
help appreciated.

Thanks,
CY


More information about the CMake mailing list