[CMake] qt3 vs qt4: kde3uic.cmake

Andreas Beckermann b_mann at gmx.de
Thu May 18 16:24:42 EDT 2006


Hi
This is using cmake-2.4.2 on a gentoo machine.
Gentoo has qt3 installed at /usr/qt/3. QTDIR is set accordingly. Unfortunately 
this machine also has qt4 installed and /usr/bin/uic is a symlink to uic from 
qt4.

With the current cmake version both, moc and uic, are apparently catched 
correctly, however when compiling a .ui file (in a kde3 environment, i.e. 
using kde3_add_ui_files()) the following happens:

[...]
Generating bomodelpixmapsgui.h
cd /usr/src/boson/code/build/boson/programs 
&& /usr/qt/3/bin/uic -nounload -o /usr/src/boson/code/build/boson/programs/bomodelpixmapsgui.h /usr/src/boson/code/boson/programs/bomodelpixmapsgui.ui

-> At this point you can see that the .h file is generated correctly using qt3 
uic.

Generating bomodelpixmapsgui.cpp
cd /usr/src/boson/code/build/boson/programs 
&& /usr/bin/cmake -DKDE_UIC_FILE:STRING=/usr/src/boson/code/boson/programs/bomodelpixmapsgui.ui -DKDE_UIC_CPP_FILE:STRING=/usr/src/boson/code/build/boson/programs/bomodelpixmapsgui.cpp -DKDE_UIC_H_FILE:STRING=/usr/src/boson/code/build/boson/programs/bomodelpixmapsgui.h -P /usr/share/CMake/Modules/kde3uic.cmake

-> Here we have a problem: kde3uic.cmake is used. See below.

Generating bomodelpixmapsgui.moc.cpp
cd /usr/src/boson/code/build/boson/programs 
&& /usr/qt/3/bin/moc /usr/src/boson/code/build/boson/programs/bomodelpixmapsgui.h -o /usr/src/boson/code/build/boson/programs/bomodelpixmapsgui.moc.cpp

-> moc works correctly again.

[...]

Linking CXX executable bomodelpixmaps
[...]
CMakeFiles/bomodelpixmaps.dir/bomodelpixmaps.o: In function `BoModelPixmaps':
/usr/src/boson/code/boson/programs/bomodelpixmaps.cpp:468: undefined reference 
to `BoModelPixmapsGUI::BoModelPixmapsGUI(QWidget*, char const*, unsigned 
int)'
[...]

Linking does not work here, as the generated .cpp file is not complete.
kde3uic.cmake is used to generate the .cpp file, which has the following line:

EXECUTE_PROCESS(COMMAND uic

and thus it'll use "uic", i.e. /usr/bin/uic (from qt4) to generate the .cpp 
file, instead of /usr/qt/3/bin/uic.


In order to fix this problem, I propose to forward QT_MOC_EXECUTABLE to the 
kde3uic.cmake script and then use that variable, instead of the hardcoded 
binary name. Just like it is done with the KDE_UIC_CPP and _H and _FILE 
strings.

CU
Andi


More information about the CMake mailing list