[CMake] Qt4

Filipe Sousa filipe at ipb.pt
Wed Jul 20 08:53:26 EDT 2005


On Wednesday 20 July 2005 12:51, Alexander Neundorf wrote:
> ...
>
> > >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})?
>
> AFAIK cmake generates only dependencies to existing included files, i.e.
> not to files which have to be generated first.
> So yes, you have to use SET_SOURCE_FILES_PROPERTIES(). Also make sure
> that you don't overwrite any existing manually set depends, since
> OBJECT_DEPENDS *sets* the value, it doesn't *append*.
>
> Bye
> Alex

I wrote my own FindQt4 so that I can easily do things like this:

SET(sources
  main.cc
  MainWindow.cc	MainWindow.h
  resources.qrc
  MyDialog.ui
)
QT_ADD_EXECUTABLE(exe ${sources})
TARGET_LINK_LIBRARIES(exe ${QT_GUI_LIBRARY})

QT_ADD_EXECUTABLE can handle resources, user interfaces (not working yet) and 
moc.
My problem is with .ui files. I want cmake handle .ui files the way qmake 
does. QMake will only generate the ui_MyDialog.h if one of the source file 
includes that file.

I wrote this macro to make MainWindow.cc depending on ui_MyDialog.h
QT_UI_DEPENDS(MyDialog.ui MainWindow.cc). I think QT_ADD_EXECUTABLE should 
handle everything.


-- 
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/20050720/26985107/attachment.pgp


More information about the CMake mailing list