Problem with cmake 2.4.x and FindQt4 from kdelibs
David Faure
faure at kde.org
Thu Jul 3 18:22:05 CEST 2008
On Thursday 03 July 2008, Tobias Hunger wrote:
> 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?
I'll let the experts answer on how the bug can/should be fixed, but in case it helps:
in my qt-only app I simply added this line.
FIND_LIBRARY(QT_QTDBUS_LIBRARY NAMES QtDBus QtDBus4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the Kde-buildsystem
mailing list