1 # - Find the KDE4 include and library dirs, KDE preprocessors and define a some macros
3 # This module defines the following variables:
5 # KDELIBS4_FOUND - set to TRUE if everything required for building KDE software has been found
7 # KDE4_DEFINITIONS - compiler definitions required for compiling KDE software
8 # KDE_DEFAULT_HOME - default home directory
9 # KDE4_TARGET_PREFIX - namespace of the exported libraries
10 # KDE4_ENABLE_EXCEPTIONS - compiler flags required for compiling software with exceptions enabled
11 # KDE4_INCLUDES - all include directories required for KDE, i.e.
12 # KDE4_INCLUDE_INSTALL_DIR, but also the Katie and X11 include directories
13 # KDE4_EXEC_INSTALL_PREFIX - the general executable prefix
14 # KDE4_SHARE_INSTALL_PREFIX - the general shared data prefix
15 # KDE4_LIB_INSTALL_DIR - the directory where libraries from kdelibs are installed
16 # KDE4_LIBEXEC_INSTALL_DIR - the directory where libexec executables from kdelibs are installed
17 # KDE4_PLUGIN_INSTALL_DIR - the directory where plugins from kdelibs are installed
18 # KDE4_INCLUDE_INSTALL_DIR - the directory where headers from kdelibs are installed
19 # KDE4_BIN_INSTALL_DIR - the directory where executables from kdelibs are installed
20 # KDE4_SBIN_INSTALL_DIR - the directory where system executables from kdelibs are installed
21 # KDE4_DATA_INSTALL_DIR - the parent directory where kdelibs applications install their data
22 # KDE4_CONFIG_INSTALL_DIR - the directory where config files from kdelibs are installed
23 # KDE4_ICON_INSTALL_DIR - the directory where icons from kdelibs are installed
24 # KDE4_IMPORTS_INSTALL_DIR - the directory where imports from kdelibs are installed
25 # KDE4_LOCALE_INSTALL_DIR - the directory where translations from kdelibs are installed
26 # KDE4_SOUND_INSTALL_DIR - the directory where sound files from kdelibs are installed
27 # KDE4_TEMPLATES_INSTALL_DIR - the directory where templates (Create new file...) from kdelibs are installed
28 # KDE4_WALLPAPER_INSTALL_DIR - the directory where wallpapers from kdelibs are installed
29 # KDE4_AUTOSTART_INSTALL_DIR - the directory where autostart from kdelibs are installed
30 # KDE4_XDG_APPS_INSTALL_DIR - the XDG apps dir from kdelibs
31 # KDE4_XDG_DIRECTORY_INSTALL_DIR - the XDG directory from kdelibs
32 # KDE4_XDG_MIME_INSTALL_DIR - the XDG mimetypes install dir from kdelibs
33 # KDE4_SYSCONF_INSTALL_DIR - the directory where sysconfig files from kdelibs are installed
34 # KDE4_SERVICES_INSTALL_DIR - the directory where service (desktop, protocol, ...) files from kdelibs are installed
35 # KDE4_SERVICETYPES_INSTALL_DIR - the directory where servicestypes desktop files from kdelibs are installed
36 # KDE4_DBUS_INTERFACES_INSTALL_DIR - the directory where dbus interfaces from kdelibs are installed
37 # KDE4_DBUS_SERVICES_INSTALL_DIR - the directory where dbus service files from kdelibs are installed
38 # KDE4_DBUS_SYSTEM_SERVICES_INSTALL_DIR - the directory where dbus system services from kdelibs are installed
40 # The following variables are defined for the various tools required to
41 # compile KDE software:
43 # KDE4_KCFGC_EXECUTABLE - the kconfig_compiler executable
44 # KDE4_MAKEKDEWIDGETS_EXECUTABLE - the makekdewidgets executable
46 # This module allows to depend on a particular minimum version of kdelibs.
47 # To acomplish that one should use the appropriate cmake syntax for
48 # find_package. For example to depend on kdelibs >= 4.24.0 one should use
50 # find_package(KDELibs4 4.24.0 REQUIRED)
52 # Copyright (c) 2023 Ivailo Monev <xakepa10@gmail.com>
54 # Redistribution and use is allowed according to the terms of the BSD license.
55 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
57 # Only do something if it hasn't been found yet
58 if(NOT KDELIBS4_FOUND)
59 set(KDELIBS4_FOUND TRUE)
61 set(KDE4_DEFINITIONS "@KDE4_DEFINITIONS@")
62 set(KDE_DEFAULT_HOME "@KDE_DEFAULT_HOME@")
63 set(KDE4_TARGET_PREFIX "@KDE4_TARGET_PREFIX@")
64 set(KDE4_ENABLE_EXCEPTIONS "@KDE4_ENABLE_EXCEPTIONS@")
66 set(KDE4_EXEC_INSTALL_PREFIX "@KDE4_EXEC_INSTALL_PREFIX@")
67 set(KDE4_SHARE_INSTALL_PREFIX "@KDE4_SHARE_INSTALL_PREFIX@")
68 set(KDE4_BIN_INSTALL_DIR "@KDE4_BIN_INSTALL_DIR@")
69 set(KDE4_SBIN_INSTALL_DIR "@KDE4_SBIN_INSTALL_DIR@")
70 set(KDE4_LIB_INSTALL_DIR "@KDE4_LIB_INSTALL_DIR@")
71 set(KDE4_LIBEXEC_INSTALL_DIR "@KDE4_LIBEXEC_INSTALL_DIR@")
72 set(KDE4_INCLUDE_INSTALL_DIR "@KDE4_INCLUDE_INSTALL_DIR@")
73 set(KDE4_PLUGIN_INSTALL_DIR "@KDE4_PLUGIN_INSTALL_DIR@")
74 set(KDE4_IMPORTS_INSTALL_DIR "@KDE4_IMPORTS_INSTALL_DIR@")
75 set(KDE4_CONFIG_INSTALL_DIR "@KDE4_CONFIG_INSTALL_DIR@")
76 set(KDE4_DATA_INSTALL_DIR "@KDE4_DATA_INSTALL_DIR@")
77 set(KDE4_ICON_INSTALL_DIR "@KDE4_ICON_INSTALL_DIR@")
78 set(KDE4_LOCALE_INSTALL_DIR "@KDE4_LOCALE_INSTALL_DIR@")
79 set(KDE4_SERVICES_INSTALL_DIR "@KDE4_SERVICES_INSTALL_DIR@")
80 set(KDE4_SERVICETYPES_INSTALL_DIR "@KDE4_SERVICETYPES_INSTALL_DIR@")
81 set(KDE4_SOUND_INSTALL_DIR "@KDE4_SOUND_INSTALL_DIR@")
82 set(KDE4_TEMPLATES_INSTALL_DIR "@KDE4_TEMPLATES_INSTALL_DIR@")
83 set(KDE4_WALLPAPER_INSTALL_DIR "@KDE4_WALLPAPER_INSTALL_DIR@")
84 set(KDE4_AUTOSTART_INSTALL_DIR "@KDE4_AUTOSTART_INSTALL_DIR@")
85 set(KDE4_XDG_APPS_INSTALL_DIR "@KDE4_XDG_APPS_INSTALL_DIR@")
86 set(KDE4_XDG_DIRECTORY_INSTALL_DIR "@KDE4_XDG_DIRECTORY_INSTALL_DIR@")
87 set(KDE4_XDG_MIME_INSTALL_DIR "@KDE4_XDG_MIME_INSTALL_DIR@")
88 set(KDE4_SYSCONF_INSTALL_DIR "@KDE4_SYSCONF_INSTALL_DIR@")
89 set(KDE4_DBUS_INTERFACES_INSTALL_DIR "@KDE4_DBUS_INTERFACES_INSTALL_DIR@")
90 set(KDE4_DBUS_SERVICES_INSTALL_DIR "@KDE4_DBUS_SERVICES_INSTALL_DIR@")
91 set(KDE4_DBUS_SYSTEM_SERVICES_INSTALL_DIR "@KDE4_DBUS_SYSTEM_SERVICES_INSTALL_DIR@")
93 if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
94 set(KDE4_DEFINITIONS "${KDE4_DEFINITIONS} -DNDEBUG")
97 find_package(Katie QUIET REQUIRED 4.14.0)
98 find_package(X11 QUIET REQUIRED)
100 # add the found KDE, Katie and X11 include directories to KDE4_INCLUDES, the
101 # ${KDE4_INCLUDE_INSTALL_DIR}/KDE directory is for forwarding includes, e.g.
102 # #include <KMainWindow>
104 ${KDE4_INCLUDE_INSTALL_DIR}
105 ${KDE4_INCLUDE_INSTALL_DIR}/KDE
110 # add some more default search paths
111 set(CMAKE_SYSTEM_INCLUDE_PATH
112 ${CMAKE_SYSTEM_INCLUDE_PATH}
113 "${KDE4_INCLUDE_INSTALL_DIR}"
116 set(CMAKE_SYSTEM_PROGRAM_PATH
117 ${CMAKE_SYSTEM_PROGRAM_PATH}
118 "${KDE4_BIN_INSTALL_DIR}"
121 set(CMAKE_SYSTEM_LIBRARY_PATH
122 ${CMAKE_SYSTEM_LIBRARY_PATH}
123 "${KDE4_LIB_INSTALL_DIR}"
126 set(kde_cmake_module_dir "${KDE4_DATA_INSTALL_DIR}/cmake/modules")
127 # get the directory of the current file, used later on in the file
128 get_filename_component(kdelibs4_config_dir ${CMAKE_CURRENT_LIST_FILE} PATH)
130 # allow searching cmake modules in the kde install locations
131 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${kde_cmake_module_dir}")
133 # KDELibs4ConfigVersion.cmake contains KDE version
134 include(${kdelibs4_config_dir}/KDELibs4ConfigVersion.cmake)
136 # KDE4Defaults.cmake contains KDE defaults
137 include(${kdelibs4_config_dir}/KDE4Defaults.cmake)
139 # This file contains the exported library and tools targets from kdelibs, e.g. the library
140 # target "kdeui" is exported as "KDE4::kdeui". The "KDE4::" is used as "namespace" to separate
141 # the imported targets from "normal" targets, it is stored in KDE4_TARGET_PREFIX. This
142 # export-file is generated and installed by the toplevel
143 include(${kdelibs4_config_dir}/KDELibs4Targets.cmake)
145 set(KDE4_KCFGC_EXECUTABLE ${KDE4_TARGET_PREFIX}kconfig_compiler)
146 set(KDE4_MAKEKDEWIDGETS_EXECUTABLE ${KDE4_TARGET_PREFIX}makekdewidgets)
148 # KDE4Macros.cmake contains all the KDE specific macros
149 include(${kdelibs4_config_dir}/KDE4Macros.cmake)
152 "${kde_cmake_module_dir}/kde4_exec.sh.in"
153 "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/kde4_exec.sh"
157 COPY "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/kde4_exec.sh"
158 DESTINATION "${CMAKE_BINARY_DIR}"
159 FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ WORLD_READ
162 if(NOT KDELIBS4_FIND_QUIETLY)
163 message(STATUS "Found KDE version: ${KDE_VERSION}")