Qt component defines

Pau Garcia i Quiles pgquiles at elpauer.org
Thu Aug 27 00:27:16 CEST 2009

On Wed, Aug 26, 2009 at 11:25 PM, Christoph Feck<christoph at maxiom.de> wrote:
> Hi,
> When using Qt qmake, you define the actual Qt components using the "Qt += Xml"
> etc. flags. In addition to adjusting include and linking options, this also
> adds an "QT_XML_LIB" define.
> The problem is that QtTest headers (from 4.6-stable branch) conditionally
> define GUI related classes based on the QT_GUI_LIB define to avoid linking
> with QtGui on pure QtCore tests.
> CMake, however, does not set these defines, and I am wondering if it should,
> or if I should workaround that in the project files that currently fail.
> For example, unless I use "add_definitions(-DQT_GUI_LIB)" I get errors about
> missing symbols when compiling skrooge and kdevelop.

I forwarded the OP mail to Clinto Stimpson, who is the FindQt4.cmake
module maintainer. This is his answer:

UseQt4.cmake adds -D flags for each module.
Are they not correct?  When I added those -D flags it was based on
qmake's behavior.


I guess the problem is in KDE we do not do INCLUDE( ${QT_USE_FILE} )
because we do not use the QT_LIBRARIES var. The reason we do not do
that is with so many projects being configured in the same CMake pass,
QT_LIBRARIES would be useless: it would contain the sum of all the Qt
libraries any one project has requested at some time by using SET(

Maybe we should do INCLUDE( ${QT_USE_FILE} ) but keep on NOT using

Pau Garcia i Quiles
(Due to my workload, I may need 10 days to answer)

More information about the Kde-buildsystem mailing list