Jump to content

Development/CMake KDE 4 3

From KDE TechBase

Changes in the buildsystem from KDE 4.2 to KDE 4.3

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

Incompatible Changes

Again we had two changes, which are incompatible. But in both cases these changes are actually bug fixes, since what they did before was actually wrong or unnecessary.

  1. Perl is not required anymore. From KDE 4.0.0 to KDE 4.2.x a call to
find_package(KDE4)

failed if Perl could not be found. This was an internal, undocumented implementation detail and not necessary, since building software for KDE4 doesn't actually require Perl in general. With KDE 4.3 this has been changed. Now Perl is still searched, but if it is not found, the CMake-run doesn't fail, it just prints a warning message. This way one dependency less is necessary to build software for KDE4. Perl is still required to build kdelibs. So if you use Perl in your project, check properly for it:

find_package(Perl REQUIRED)
# in case you didn't use the REQUIRED keyword:
if (PERL_FOUND)
...
  1. FindKdepim.cmake has been obsoleted. It was buggy, in that no other software should depend on an installed kdepim. Instead there is a FindKdepimLibs.cmake which can be used to find kdepimlibs. There are no known users of the FindKdepim.cmake module. The module is still there, but it now aborts with FATAL_ERROR.

Other Changes

Commit Policy for kdelibs/cmake/modules/

During the 4.3 cycle we introduced a commit policy for committing changes to kdelibs/cmake/modules, since commits there have the potential to break the build for everybody and can be part of the public interface of KDE: Policies/CMake_Commit_Policy

Required Versions

  • Qt >= 4.5.0 is required for now (was >= 4.4.0 for KDE 4.2)
  • automoc4 >= 0.9.88 is required now (was 0.9.87 for KDE 4.2)
  • (Windows only): the support package KDEWIN32 has been renamed to KDEWin

New option (Windows only): KDE4_ENABLE_UAC_MANIFEST

This option is only available under Windows, by default it is off. It enables support for generating uac manifest files (or something like that).

MACRO_OPTIONAL_ADD_SUBDIRECTORY(): disable everything

The macro MACRO_OPTIONAL_ADD_SUBDIRECTORY() from MacroOptionalAddSubDirectory.cmake now respects a new global CMake variable DISABLE_ALL_OPTIONAL_SUBDIRECTORIES. If the variable DISABLE_ALL_OPTIONAL_SUBDIRECTORIES is set to TRUE for the first CMake run on the project, all optional subdirectories will be disabled by default (but can of course be enabled via the respective options). E.g. the following will disable all optional subdirectories except the one named "kcalc":

  $ cmake -DDISABLE_ALL_OPTIONAL_SUBDIRECTORIES=TRUE -DBUILD_kcalc=TRUE <srcdir>


RelWithDebInfo compiler flags

In the RelWithDebInfo build type -DNDEBUG -DQT_NO_DEBUG have been added to the compiler flags.

Nepomuk libraries

In KDE 4.2 there were two variables KDE4_KNEPOMUK_LIBS and KDE4_KMETADATA_LIBS. This was a bug, they were always empty. They have been removed now (which is not incompatible, since they were empty). Instead a new and correct variable KDE4_NEPOMUK_LIBS has been added.

New Modules

Some completely new modules have been added during this cycle:

  • FindIOKit.cmake
  • FindKDEWin.cmake
  • FindLibLZMA.cmake
  • FindPulseAudio.cmake