[CMake] Building ADD_CUSTOM_TARGET dependency

Brad King brad.king at kitware.com
Thu Nov 17 09:38:39 EST 2005


Alex Brooks wrote:
> However if I managed to get it to work using:
>   ADD_CUSTOM_TARGET( 
>     lasermon.cfg ALL
>     ${GENERATE_CFG_EXE} lasermon.def lasermon.cfg
>     DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lasermon.def )
>   ADD_DEPENDENCIES( lasermon.cfg generatecfg )
> (ie adding the extra ADD_DEPENDENCIES rule fixes things)
[snip]
> Not sure why the extra rule is needed.

The ADD_DEPENDENCIES command adds dependencies between top-level 
targets...the generatecfg target should be completely up to date before 
even evaluating dependencies of the lasermon.cfg target.  The DEPENDS 
option of ADD_CUSTOM_TARGET is for file-level dependencies within the 
custom target.  The generated makefile for the custom target probably 
doesn't even have rules to build generatecfg.  I suspect that magic 
attempt to build it might be coming from a GNU make default rule.

-Brad


More information about the CMake mailing list