[cmake-developers] kde4_automoc issue

Brad King brad.king at kitware.com
Mon Jul 17 10:01:47 EDT 2006


Brad King wrote:
> 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>
>   )

Oops, I meant something more like:

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>
  )
ADD_CUSTOM_TARGET(kfoo_automoc
  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/kfoo_automoc.stamp
  )
ADD_DEPENDENCIES(kfoo kfoo_automoc)

-Brad




More information about the cmake-developers mailing list