[Cmake] ADD_CUSTOM_COMMAND and PRE_BUILD

Brad King brad.king at kitware.com
Mon, 19 Apr 2004 10:11:45 -0400


Benjamin Rutt wrote:
> Brad King <brad.king at kitware.com> writes:
> 
> 
>>Please send me the Makefile that is generated before the build occurs.
> 
> 
> See attached.

It looks like the PRE_BUILD rules do not work correctly for the Unix 
Makefiles generator.  The rules are added to the same list as the 
POST_BUILD rules.  Please submit this as a bug:

http://www.cmake.org/Bug

Thinking about this in more detail, I'm not sure this is possible to 
implement in Makefiles.  The "fix" for the bug may simply be to remove 
the feature from the documentation.  Instead you'll have to add this 
custom command's output as an "OBJECT_DEPENDS" source-file property of 
the source that needs it:

SET_SOURCE_FILES_PROPERTIES(foo.cpp PROPERTIES
   OBJECT_DEPENDS "${dummyproj_BINARY_DIR}/hosts")

Then use the first signature of ADD_CUSTOM_COMMAND listed in the help.

Thanks,
-Brad