[CMake] FindQt changes

William A. Hoffman billlist at nycap.rr.com
Thu Sep 1 10:49:38 EDT 2005


To reduce the complexity of the FindQt.cmake module and user CMakeList files and maintain backwards compatibility, the following changes are going to be made to FindQt*.cmake.


1. FindQt.cmake will be deprecated, and will look something like this:

MESSAGE("FindQt is deprecated, use FindQt3.cmake for Qt3 and FindQt4.cmake for Qt4")
MESSAGE("FindQt3 being included for backwards compatibility.")
INCLUDE(FindQt3)

2. A new module will be created :

CMakeQtDetect.cmake, this module will find all installed Qt versions on the machine.
It will set boolean flags letting the user know which Qt versions were found.
This way projects that can work with either Qt3 or Qt4 can choose which one to Find
before finding it.

So, if you had a project that worked with Qt3 and Qt4, but preferred Qt3, you would do this:

INCLUDE(CMakeQTDectect)
IF(Qt3_INSTALLED)
  INCLUDE(FindQt3)
ELSEIF(Qt3_INSTALLED)
  IF(Qt4_INSTALLED)
     INCLUDE(FindQt4)
  ENDIF(Qt4_INSTALLED)
ENDIF(Qt3_INSTALLED)

If the project is only qt3 or qt4, then you should directly use FindQt3 or FindQt4.

3. A UseQt4.cmake file will be created for Qt4 so that qt4 projects can do this:

INCLUDE(FindQt4)
IF(QT_FOUND)
   INCLUDE(${QT_USE_FILE})
ENDIF(QT_FOUND)

The QT_USE_FILE will default to linking in qt core and gui, to change that you
will set variables like this:

SET(QT_USE_NETWORK TRUE)    # set to TRUE to use network, default false
SET(QT_DO_NOT_USE_GUI TRUE) # set to TRUE to NOT use GUI, default false (meaning use GUI by default)
SET(QT_USE_SQL TRUE)        # set to TRUE to use SQL, default false
SET(QT_USE_XML TRUE)        # set to TRUE to use XML, default false
SET(QT_USE_OPENGL TRUE)     # set to TRUE to use OpenGL, default false
INCLUDE(${QT_USE_FILE})

-Bill



More information about the CMake mailing list