Problem with cmake 2.4.x and FindQt4 from kdelibs

Tobias Hunger tobias at aquazul.com
Thu Jul 3 17:47:43 CEST 2008


Hello there!

I am trying to build a Qt-only D-Bus application using the FindQt4.cmake 
package found in kdelibs/cmake/modules. That documents a QT_USE_QTDBUS 
variable that can be set. So I came up with the following code in my 
CMakeLists.txt:

FIND_PACKAGE(Qt4 REQUIRED)

[...]

SET(QT_USE_QTDBUS ON)
SET(QT_DONT_USE_QTGUI ON)
INCLUDE(${QT_USE_FILE})

[...]

TARGET_LINK_LIBRARIES( [...] ${QT_LIBRARIES} [...])

and assumed that my target would get linked against the Qt DBus library. 
Unfortunately that is only true for cmake 2.6 but not for cmake 2.4.x.

After doing some research I found the culprit: FindQt4.cmake defines 
QT_USE_FILE as follows:

SET(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake)

So I end up including UseQt4.cmake as shipped by CMake. Unfortunately the 
version shipped with cmake 2.4.x is not aware of Qt DBus and thus never
adds the required flags to QT_LIBRARIES.

So how should I work around this problem? I am requiring cmake version 2.6.0 
for now (my code is not part of a "normal" kde build, so that should be fine 
for the time being and at least documents the failure that was there before 
anyway). Should we invest work to hack around a problem that is not there 
with a later *stable* version of the tool used in the first place?

Best Regards,
Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20080703/aa9ac41e/attachment.pgp 


More information about the Kde-buildsystem mailing list