[CMake] Qt4

Filipe Sousa filipe at ipb.pt
Tue Jul 19 09:15:03 EDT 2005


I've seen commits to FindQt4.cmake in CVS. I just realize that neither 
QT_WRAP_CPP nor QT_WRAP_UI will work with Qt4.

I have my own QT_WRAP_CPP that works fine:
  # output file
  GET_FILENAME_COMPONENT(basename ${header} NAME_WE)
  SET(output_file ${CMAKE_CURRENT_BINARY_DIR}/${basename}.moc.${source_ext})

  # -D flags
  GET_DIRECTORY_PROPERTY(flags DEFINITIONS)
  SEPARATE_ARGUMENTS(flags)

  # -I flags
  GET_DIRECTORY_PROPERTY(includes INCLUDE_DIRECTORIES)
  FOREACH(inc ${includes})
    SET(flags ${flags} ${CMAKE_INCLUDE_FLAG_CXX}${inc})
  ENDFOREACH(inc)

  ADD_CUSTOM_COMMAND(
    OUTPUT   ${output_file}
    COMMAND  ${QT_MOC_EXECUTABLE}
    ARGS     ${flags} ${header} -o ${output_file}
    DEPENDS  ${QT_MOC_EXECUTABLE} ${header}
    COMMENT  "Qt Wrap Files"
    )

Now, the uic in qt4 only generates one file, the header file, but I can't get 
it automatically generated:

  GET_FILENAME_COMPONENT(basename ${ui_file} NAME_WE)
  SET(ui_header ${CMAKE_CURRENT_BINARY_DIR}/ui_${basename}.${header_ext})

  ADD_CUSTOM_COMMAND(
    OUTPUT  ${ui_header}
    COMMAND ${QT_UIC_EXECUTABLE}
    ARGS    ${ui_file} -o ${ui_header}
    DEPENDS ${ui_file}
    )

If I have a file that includes the generated file, shouldn't cmake generated 
dependencies on this file and automatically generate the header file from .ui 
file or do I have to use SET_SOURCE_FILES_PROPERTIES(${source} PROPERTIES 
OBJECT_DEPENDS ${ui_header})?

-- 
Filipe Sousa
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20050719/c51c0633/attachment.pgp


More information about the CMake mailing list