[CMake] cmake Qt4 and uic3

Alexander Neundorf a.neundorf-work at gmx.net
Mon Sep 20 15:40:11 EDT 2010


On Monday 20 September 2010, Kelly Burkhart wrote:
> Hello, I'm in the process of converting our build system from qmake to
> cmake.  We have a number of projects that use uic3 rather than uic and
> I'm having a difficult time figuring out how to run the older command.
>
> I've tried copying QT4_WRAP_UI to a differently named macro and
> changing the 'COMMAND ${QT_UIC_EXECUTABLE}' line to: 'COMMAND
> ${QT_UIC3_EXECUTABLE}' with no luck.
>
> As I continue to dig into this has anyone else come up with a recipe
> for doing this?

In KDE4 we support this.
In KDE4Macros.cmake, search for "KDE4_ADD_UI3_FILES"
http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/KDE4Macros.cmake?view=markup

There add_custom_command() is used three time for the three files which have 
to be generated (header, source and moc).
Instead of calling uic3 directly a cmake script kde4uic.cmake is called. IIRC 
the reason for this is that in KDE we have to replace some strings in the 
generated files. If you don't need that, you can put the commands used in 
kde4uic.cmake in the execute_process() calls directly into the 
add_custom_command() calls in kde4_add_ui3_files(), instead of calling cmake 
there:

http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/kde4uic.cmake?view=markup

Alex


More information about the CMake mailing list