[Cmake] Converting from CMake 1.6 to CMake 1.8

Andy Cedilnik andy.cedilnik at kitware.com
Tue, 27 Jan 2004 10:55:34 -0500


Hi Randy,

I would say (Mastering CMake page 85):

SET(tgts)
FOREACH(MY_TARGET target1 target2 target3)
  ADD_CUSTOM_COMMAND(
    OUTPUT ${MY_TARGET}
    COMMAND some command
    ARGS some args)
  )
  SET(tgts ${tgts} ${MY_TARGET})
ENDFOREACH(MY_TARGET)

ADD_CUSTOM_TARGET( run DEPENDS ${tgts})

			Andy

On Tue, 2004-01-27 at 10:45, Randy Casstevens wrote:
> This is the second time I posted this message.  The first time I posted it 
> hotmail converted
> my message into html and made it difficult for some to read.
> 
> When converting from CMake 1.6 to CMake 1.8, we ran into a problem with
> one of our targets.
> 
> Here is some example code that illustrates the problem:
> 
> >FOREACH(MY_TARGET
> >         target1 target2 target3)
> >     ADD_CUSTOM_TARGET(${MY_TARGET} some command...)
> >     ADD_CUSTOM_COMMAND(
> >     TARGET run
> >     DEPENDS ${MY_TARGET}
> >     )
> >ENDFOREACH(MY_TARGET)
> 
> When using CMake 1.6, the targets would be added to the dependency list
> for the run target.  But, when we converted to CMake 1.8, the targets were
> not added to the dependency list.  Why did this happen?  How can it be
> fixed?