Development/CMake KDE 4 4: Difference between revisions

From KDE TechBase
Line 37: Line 37:
* FindQt4.cmake has been split into FindQt4.cmake, Qt4Macros.cmake and Qt4ConfigDependentSettings.cmake.
* FindQt4.cmake has been split into FindQt4.cmake, Qt4Macros.cmake and Qt4ConfigDependentSettings.cmake.
* Improved support for flexible Qt install locations under Windows (see "Imported targets")
* Improved support for flexible Qt install locations under Windows (see "Imported targets")
====Imported Targets====


===New libraries: knewstuff3, kunitconversion and kdewebkit===
===New libraries: knewstuff3, kunitconversion and kdewebkit===

Revision as of 20:14, 27 January 2010

Changes in the buildsystem from KDE 4.3 to KDE 4.4

As with KDE 4.2 and 4.3, also for KDE 4.4 still CMake >= 2.6.2 is required, so no changes in this regard.

Incompatible Changes

FindQt4.cmake: Imported Targets for the libraries

This change is under certain circumstances not source compatible. For each of the Qt libraries now an imported library target is created, e.g. for the QtCore library an imported target named "Qt4::QtCore" is created, and similar for the other libraries. If the variable QT_USE_IMPORTED_TARGETS is set to TRUE before searching for Qt4, then the Qt library variables like QT_QTCORE_LIBRARY are set to point at these imported targets. When doing a FIND_PACKAGE(KDE4), this variable is set automatically to TRUE. This change is source incompatible in the following circumstances:

  • if you expect the variable to contain a file path, e.g. if you test for file endings or similar things
  • if you use TRY_RUN() or TRY_COMPILE() directly and put the QT-library variables into the CMAKE_REQUIRED_LIBRARIES variable. Using TRY_RUN() and TRY_COMPILE() directly is in general not recommended. Consider using CHECK_C/CXX_SOURCE_COMPILES() and CHECK_C/CXX_SOURCE_RUNS() instead. Both are easier to use, and both handle imported targets properly. So if you hit this problem in TRY_RUN() or TRY_COMPILE(), consider switching to these macros instead, or use the HANDLE_IMPORTED_TARGETS_IN_CMAKE_REQUIRED_LIBRARIES() macro coming with KDE (since 4.3).

In all other uses there should be no incompatibilities. E.g. usage in TARGET_LINK_LIBRARIES() works the same, and you can also test the variables for validity: if (QT_QTCORE_LIBRARY) ...



Other Changes

Commit Policy for kdelibs/cmake/modules/

The commit policy introduced during the 4.3 development cycle has been kept and we try to follow it.

Major FindQt4.cmake improvements

A lot of work went into FindQt4.cmake. This includes:

  • Synced with FindQt4.cmake from CMake 2.8.0. Our version and the one shipped with CMake 2.8.0 are now almost identical again, there are only a bunch of minor differences left.
  • Support for Qt 4.6 added. I.e. support for the QtMultimedia and QtScriptTools libraries has been added.
  • Support for ActiveQt (Windows only) has been added.
  • New variables QT_COLLECTIONGENERATOR_EXECUTABLE, QT_DESIGNER_EXECUTABLE and QT_LINGUIST_EXECUTABLE.
  • New macros QT4_CREATE_TRANSLATION() and QT4_ADD_TRANSLATION().
  • Improved support for Mac OSX, including Qt installed as frameworks
  • Improved support for Windows, including handling release/debug libraries (see "Imported targets")
  • Support for static Qt libraries and the UseQt.cmake file fixed.
  • FindQt4.cmake has been split into FindQt4.cmake, Qt4Macros.cmake and Qt4ConfigDependentSettings.cmake.
  • Improved support for flexible Qt install locations under Windows (see "Imported targets")

Imported Targets

New libraries: knewstuff3, kunitconversion and kdewebkit

With KDE 4.4 3 new libraries were added to kdelibs: the knewstuff3 library, the kunitconversion library and the kdewebkit library. These libraries come with their associated variables. So if you want to link against these libraries, use ${KDE4_KNEWSTUFF3_LIBS}, ${KDE4_KUNITCONVERSION_LIBS} and ${KDE4_KDEWEBKIT_LIBS} respectively. They don't require an additional include directory.

New kdecore component KAuth

With KDE 4.4 the kdecore library now contains a new authorization component, called KAuth, which support PolicyKit. Along with it come two new macros, KDE4_INSTALL_AUTH_ACTIONS() and KDE4_INSTALL_AUTH_HELPER_FILES(). These macros help with generating and installing the policy action files.

Other minor changes

  • The file MacroAddFileDependencies.cmake has been removed. It is not shipped anymore since this file is part of CMake 2.6.2, which we still depend on for KDE 4.4. So it is not necessary to keep an identical copy in KDE.
  • A new install location variable DBUS_SYSTEM_SERVICES_INSTALL_DIR has been added. It defaults to ${CMAKE_INSTALL_PREFIX}/share/dbus-1/system-services/ . You probably want to set it to some system wide location.
  • Macro KDE4_ADD_KCFG_FILES(): new optional argument USE_RELATIVE_PATH. Use this option to specify the (relative) path where the generated files will be put.
  • Support for building KDE4 on GNU Hurd has been improved.

New Modules

Some completely new installed modules have been added during this cycle:

  • FindHUNSPELL.cmake
  • FindKDevPlatform.cmake
  • FindLibAttica.cmake
  • FindSharedDesktopOntologies.cmake


Also added were FindPolkitQt-1.cmake and FindPolkitQt.cmake, but both are used only internally inside kdelibs and both are not installed.