[cmake-developers] kde4_automoc issue

Brad King brad.king at kitware.com
Mon Jul 17 10:00:22 EDT 2006


Alexander Neundorf wrote:
> if (need_automoc)
>    # create a file with all files for automoc
>    file(WRITE kfoo_automoc_files ${automocfiles)
>    # create a target which will be built before the actual target
>    ADD_CUSTOM_TARGET(kfoo_automoc COMMAND <scan all files from kfoo_automoc
>                       and run moc if required> )
>    ADD_DEPENDENCIES(kfoo kfoo_automoc)
> endif
> 
> This would move the automoc from cmake time to buildtime, which is a good 
> thing.

Try this:

ADD_CUSTOM_TARGET(kfoo_automoc)
ADD_CUSTOM_COMMAND(
  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/kfoo_automoc.stamp
  COMMAND <scan all files and run moc, then touch kfoo_automoc.stamp>
  DEPENDS <all files>
  )

-Brad



More information about the cmake-developers mailing list