ECM-KDE-MODULES(7)

NAME
ecm-kde-modules - ECM KDE Modules Reference

INTRODUCTION

Extra CMake Modules (ECM) provides several modules that provide default settings (like installation directories, compiler flags and other CMake options) aimed at software produced by the KDE modules; these are documented here. ECM also provides modules with more general functionality, documented in ecm-modules(7), and ones that extend the functionality of the find_package command, documented in ecm-find-modules(7).

To use these modules, you need to tell CMake to find the ECM package, and then add either ${ECM_MODULE_PATH} or ${ECM_KDE_MODULE_DIR} to the CMAKE_MODULE_PATH variable:

find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_DIR})

Using ${ECM_MODULE_PATH} will also make the other types of modules available.

ALL KDE MODULES

  KDECMakeSettings

Changes various CMake settings to what the KDE community views as more sensible defaults.

It is split into three parts, which can be independently disabled if desired.

  Runtime Paths

The default runtime path (used on Unix systems to search for dynamically-linked libraries) is set to include the location that libraries will be installed to (as set in LIB_INSTALL_DIR), and also the linker search path.

Note that LIB_INSTALL_DIR needs to be set before including this module. Typically, this is done by including the KDEInstallDirs module.

This section can be disabled by setting KDE_SKIP_RPATH_SETTINGS to TRUE before including this module.

  Testing

Testing is enabled by default, and an option (BUILD_TESTING) is provided for users to control this. See the CTest module documentation in the CMake manual for more details.

This section can be disabled by setting KDE_SKIP_TEST_SETTINGS to TRUE before including this module.

  Build Settings

Various CMake build defaults are altered, such as searching source and build directories for includes first and enabling automoc by default.

This section can be disabled by setting KDE_SKIP_BUILD_SETTINGS to TRUE before including this module.

  KDECompilerSettings

Set useful compile and link flags for C++ (and C) code.

Enables many more warnings than the default, and sets stricter modes for some compiler features. By default, exceptions are disabled; kde_target_enable_exceptions() can be used to re-enable them for a specific target.

This module provides the following functions:

kde_source_files_enable_exceptions([file1 [file2 [...]]])

Enables exceptions for specific source files. This should not be used on source files in a language other than C++.

kde_target_enable_exceptions(target <INTERFACE|PUBLIC|PRIVATE>)

Enables exceptions for a specific target. This should not be used on a target that has source files in a language other than C++.

kde_enable_exceptions()

Enables exceptions for C++ source files compiled for the CMakeLists.txt file in the current directory and all subdirectories.

  KDEFrameworkCompilerSettings

Set stricter compile and link flags for KDE Frameworks modules.

The KDECompilerSettings module is included and, in addition, various defines that affect the Qt libraries are set to enforce certain conventions.

For example, constructions like QString("foo") are prohibited, instead forcing the use of QLatin1String or QStringLiteral, and some Qt-defined keywords like signals and slots will not be defined.

  KDEInstallDirs

Define KDE standard installation directories.

Inclusion of this module defines the following variables (default values in parentheses):

BUNDLE_INSTALL_DIR
    (Mac only) application bundles (/Applications/KDE5)

BIN_INSTALL_DIR
    user executables (bin)

SBIN_INSTALL_DIR
    system admin executables (sbin)

LIB_INSTALL_DIR
    object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian)

LIBEXEC_INSTALL_DIR
    internal executables (${LIB_INSTALL_DIR}/libexec)

INSTALL_TARGETS_DEFAULT_ARGS
    combines BUNDLE_INSTALL_DIR, BIN_INSTALL_DIR and LIB_INSTALL_DIR; see below

INCLUDE_INSTALL_DIR
    C and C++ header files (include)

QT_PLUGIN_INSTALL_DIR
    Qt plugins (${LIB_INSTALL_DIR}/plugins)

PLUGIN_INSTALL_DIR
    KDE plugins (${QT_PLUGIN_INSTALL_DIR})

IMPORTS_INSTALL_DIR
    QML imports (${QT_PLUGIN_INSTALL_DIR}/imports)

QML_INSTALL_DIR
    QML2 imports (${LIB_INSTALL_DIR}/qml)

CMAKECONFIG_INSTALL_PREFIX
    CMake configuration files (${LIB_INSTALL_DIR}/cmake)

DATA_INSTALL_DIR
    read-only architecture-independent data (share)

KCONF_UPDATE_INSTALL_DIR
    kconf_update files (${DATA_INSTALL_DIR}/kconf_update)

DBUS_INTERFACES_INSTALL_DIR
    dbus interfaces (share/dbus-1/interfaces)

DBUS_SERVICES_INSTALL_DIR
    dbus services (share/dbus-1/services)

DBUS_SYSTEM_SERVICES_INSTALL_DIR
    dbus system services (share/dbus-1/system-services)

HTML_INSTALL_DIR
    HTML documentation (share/doc/HTML)

ICON_INSTALL_DIR
    the icons (share/icons)

KCFG_INSTALL_DIR
    kconfig files (share/config.kcfg)

KNOTIFYRC_INSTALL_DIR
    install dir for knotifyrc files (share/knotifications5)

LOCALE_INSTALL_DIR
    translations (share/locale)

MAN_INSTALL_DIR
    man pages (share/man)

SERVICES_INSTALL_DIR
    service (desktop, protocol, ...) files (share/kservices5)

SERVICETYPES_INSTALL_DIR
    service types desktop files (share/kservicetypes5)

SOUND_INSTALL_DIR
    sound files (share/sounds)

TEMPLATES_INSTALL_DIR
    templates (share/templates)

WALLPAPER_INSTALL_DIR
    wallpapers (share/wallpapers)

XDG_APPS_INSTALL_DIR
    application desktop files (share/applications)

XDG_DIRECTORY_INSTALL_DIR
    XDG directory (share/desktop-directories)

XDG_MIME_INSTALL_DIR
    mimetype XML files (share/mime/packages)

SYSCONF_INSTALL_DIR
    sysconfig files (etc)

CONFIG_INSTALL_DIR
    config files (${SYSCONF_INSTALL_DIR}/xdg)

AUTOSTART_INSTALL_DIR
    autostart files (${CONFIG_INSTALL_DIR}/autostart)

EXEC_INSTALL_PREFIX
    prefix for default values of BIN_INSTALL_DIR, SBIN_INSTALL_DIR and LIB_INSTALL_DIR (empty by default)

SHARE_INSTALL_PREFIX
    replaces "share" in the other variables if set

    The *_INSTALL_DIR variables may be passed to the DESTINATION options of install() commands for the corresponding file type. They are set in the CMake cache, and so the defaults above can be overridden by users.

    Note that these variables do not provide any information about the location of already-installed KDE software.

    The INSTALL_TARGETS_DEFAULT_ARGS variable should be used when libraries or user-executable applications are installed, in the following manner:

    install(TARGETS mylib myapp ${INSTALL_TARGETS_DEFAULT_ARGS})

    It MUST NOT be used for installing plugins, system admin executables or executables only intended for use internally by other code. Those should use one of the PLUGIN variables, SBIN_INSTALL_DIR or LIBEXEC_INSTALL_DIR respectively.

SEE ALSO

ecm(7), ecm-modules(7), ecm-find-modules(7)

COPYRIGHT
KDE Developers