Warning, /frameworks/extra-cmake-modules/kde-modules/KDEInstallDirs5.cmake is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2014-2015 Alex Merry <alex.merry@kde.org> 0002 # SPDX-FileCopyrightText: 2013 Stephen Kelly <steveire@gmail.com> 0003 # SPDX-FileCopyrightText: 2012 David Faure <faure@kde.org> 0004 # SPDX-FileCopyrightText: 2007 Matthias Kretz <kretz@kde.org> 0005 # SPDX-FileCopyrightText: 2006-2007 Laurent Montel <montel@kde.org> 0006 # SPDX-FileCopyrightText: 2006-2013 Alex Neundorf <neundorf@kde.org> 0007 # 0008 # SPDX-License-Identifier: BSD-3-Clause 0009 0010 #[=======================================================================[.rst: 0011 KDEInstallDirs5 0012 --------------- 0013 0014 Define KDE standard installation directories for Qt5/KF5 based software. 0015 0016 Note that none of the variables defined by this module provide any 0017 information about the location of already-installed KDE software. 0018 0019 Also sets ``CMAKE_INSTALL_PREFIX`` to the installation prefix of ECM, 0020 unless that variable has been already explicitly set by something else 0021 (since 5.61 and with CMake >= 3.7). 0022 0023 Inclusion of this module defines the following variables: 0024 0025 ``KDE_INSTALL_<dir>`` 0026 destination for files of a given type 0027 ``KDE_INSTALL_FULL_<dir>`` 0028 corresponding absolute path 0029 0030 where ``<dir>`` is one of (default values in parentheses and alternative, 0031 deprecated variable name in square brackets): 0032 0033 ``BUNDLEDIR`` 0034 application bundles (``/Applications/KDE``) [``BUNDLE_INSTALL_DIR``] 0035 ``EXECROOTDIR`` 0036 executables and libraries (``<empty>``) [``EXEC_INSTALL_PREFIX``] 0037 ``BINDIR`` 0038 user executables (``EXECROOTDIR/bin``) [``BIN_INSTALL_DIR``] 0039 ``SBINDIR`` 0040 system admin executables (``EXECROOTDIR/sbin``) [``SBIN_INSTALL_DIR``] 0041 ``LIBDIR`` 0042 object code libraries (``EXECROOTDIR/lib``, ``EXECROOTDIR/lib64`` or 0043 ``EXECROOTDIR/lib/<multiarch-tuple`` on Debian) [``LIB_INSTALL_DIR``] 0044 ``LIBEXECDIR`` 0045 executables for internal use by programs and libraries (``BINDIR`` on 0046 Windows, ``LIBDIR/libexec`` otherwise) [``LIBEXEC_INSTALL_DIR``] 0047 ``CMAKEPACKAGEDIR`` 0048 CMake packages, including config files (``LIBDIR/cmake``) 0049 [``CMAKECONFIG_INSTALL_PREFIX``] 0050 ``QTPLUGINDIR`` 0051 Qt plugins (``LIBDIR/plugins`` or qmake-qt5's ``QT_INSTALL_PLUGINS``) [``QT_PLUGIN_INSTALL_DIR``] 0052 ``PLUGINDIR`` 0053 Plugins (``QTPLUGINDIR``) [``PLUGIN_INSTALL_DIR``] 0054 ``QTQUICKIMPORTSDIR`` 0055 QtQuick1 imports (``QTPLUGINDIR/imports`` or qmake-qt5's ``QT_INSTALL_IMPORTS``) [``IMPORTS_INSTALL_DIR``] 0056 ``QMLDIR`` 0057 QtQuick2 imports (``LIBDIR/qml`` or qmake-qt5's ``QT_INSTALL_QML``) [``QML_INSTALL_DIR``] 0058 ``INCLUDEDIR`` 0059 C and C++ header files (``include``) [``INCLUDE_INSTALL_DIR``] 0060 ``LOCALSTATEDIR`` 0061 modifiable single-machine data (``var``) 0062 ``SHAREDSTATEDIR`` 0063 modifiable architecture-independent data (``com``) 0064 ``DATAROOTDIR`` 0065 read-only architecture-independent data root (``share``) 0066 [``SHARE_INSTALL_PREFIX``] 0067 ``DATADIR`` 0068 read-only architecture-independent data (``DATAROOTDIR``) 0069 [``DATA_INSTALL_DIR``] 0070 ``DOCBUNDLEDIR`` 0071 documentation bundles generated using kdoctools 0072 (``DATAROOTDIR/doc/HTML``) [``HTML_INSTALL_DIR``] 0073 ``KCFGDIR`` 0074 kconfig description files (``DATAROOTDIR/config.kcfg``) 0075 [``KCFG_INSTALL_DIR``] 0076 ``KCONFUPDATEDIR`` 0077 kconf_update scripts (``DATAROOTDIR/kconf_update``) 0078 [``KCONF_UPDATE_INSTALL_DIR``] 0079 ``KSERVICES5DIR`` or (since 5.89) ``KSERVICESDIR`` 0080 services for KDE Frameworks 5 (``DATAROOTDIR/kservices5``) 0081 [``SERVICES_INSTALL_DIR``] 0082 ``KSERVICETYPES5DIR`` or (since 5.89) ``KSERVICETYPESDIR`` 0083 service types for KDE Frameworks 5 (``DATAROOTDIR/kservicetypes5``) 0084 [``SERVICETYPES_INSTALL_DIR``] 0085 ``KXMLGUI5DIR`` or (since 5.89) ``KXMLGUIDIR`` 0086 kxmlgui .rc files (``DATAROOTDIR/kxmlgui5``) 0087 [``KXMLGUI_INSTALL_DIR``] 0088 ``KAPPTEMPLATESDIR`` 0089 KAppTemplate and KDevelop templates (``DATAROOTDIR/kdevappwizard/templates``) 0090 [``KDE_INSTALL_KTEMPLATESDIR``] Since 5.77. 0091 ``KFILETEMPLATESDIR`` 0092 KDevelop file templates (``DATAROOTDIR/kdevfiletemplates/templates``) Since 5.77. 0093 ``KNOTIFY5RCDIR`` or (since 5.89) ``KNOTIFYRCDIR`` 0094 knotify description files (``DATAROOTDIR/knotifications5``) 0095 [``KNOTIFYRC_INSTALL_DIR``] 0096 ``ICONDIR`` 0097 icons (``DATAROOTDIR/icons``) [``ICON_INSTALL_DIR``] 0098 ``LOCALEDIR`` 0099 locale-dependent data (``DATAROOTDIR/locale``) 0100 [``LOCALE_INSTALL_DIR``] 0101 ``SOUNDDIR`` 0102 sound files (``DATAROOTDIR/sounds``) [``SOUND_INSTALL_DIR``] 0103 ``TEMPLATEDIR`` 0104 templates (``DATAROOTDIR/templates``) [``TEMPLATES_INSTALL_DIR``] 0105 ``WALLPAPERDIR`` 0106 desktop wallpaper images (``DATAROOTDIR/wallpapers``) 0107 [``WALLPAPER_INSTALL_DIR``] 0108 ``APPDIR`` 0109 application desktop files (``DATAROOTDIR/applications``) Since 1.1.0. 0110 [``XDG_APPS_INSTALL_DIR``] 0111 ``DESKTOPDIR`` 0112 desktop directories (``DATAROOTDIR/desktop-directories``) 0113 [``XDG_DIRECTORY_INSTALL_DIR``] 0114 ``MIMEDIR`` 0115 mime description files (``DATAROOTDIR/mime/packages``) 0116 [``XDG_MIME_INSTALL_DIR``] 0117 ``METAINFODIR`` 0118 AppStream component metadata files (``DATAROOTDIR/metainfo``) 0119 ``QTQCHDIR`` 0120 documentation bundles in QCH format for Qt-extending libraries (``DATAROOTDIR/doc/qch`` or qmake-qt5's ``QT_INSTALL_DOCS``) Since 5.36.0. 0121 ``QCHDIR`` 0122 documentation bundles in QCH format (``DATAROOTDIR/doc/qch``) Since 5.36.0. 0123 ``MANDIR`` 0124 man documentation (``DATAROOTDIR/man``) [``MAN_INSTALL_DIR``] 0125 ``INFODIR`` 0126 info documentation (``DATAROOTDIR/info``) 0127 ``DBUSDIR`` 0128 D-Bus (``DATAROOTDIR/dbus-1``) 0129 ``DBUSINTERFACEDIR`` 0130 D-Bus interfaces (``DBUSDIR/interfaces``) 0131 [``DBUS_INTERFACES_INSTALL_DIR``] 0132 ``DBUSSERVICEDIR`` 0133 D-Bus session services (``DBUSDIR/services``) 0134 [``DBUS_SERVICES_INSTALL_DIR``] 0135 ``DBUSSYSTEMSERVICEDIR`` 0136 D-Bus system services (``DBUSDIR/system-services``) 0137 [``DBUS_SYSTEM_SERVICES_INSTALL_DIR``] 0138 ``SYSCONFDIR`` 0139 read-only single-machine data 0140 (``etc``, or ``/etc`` if ``CMAKE_INSTALL_PREFIX`` is ``/usr``) 0141 [``SYSCONF_INSTALL_DIR``] 0142 ``CONFDIR`` 0143 application configuration files (``SYSCONFDIR/xdg``) 0144 [``CONFIG_INSTALL_DIR``] 0145 ``AUTOSTARTDIR`` 0146 autostart files (``CONFDIR/autostart``) [``AUTOSTART_INSTALL_DIR``] 0147 ``LOGGINGCATEGORIESDIR`` 0148 Qt logging categories files directory (``DATAROOTDIR/qlogging-categories5``) Since 5.59.0 0149 ``JARDIR`` 0150 Java AAR/JAR files for Android. Since 5.62.0 0151 ``SYSTEMDUNITDIR`` 0152 Systemd Units (``lib/systemd``) 0153 [``SYSTEMD_UNIT_INSTALL_DIR``]. Since 5.65 0154 ``SYSTEMDUSERUNITDIR`` 0155 Systemd User Units (``lib/systemd/user``) 0156 [``SYSTEMD_USER_UNIT_INSTALL_DIR``]. Since 5.65 0157 ``ZSHAUTOCOMPLETEDIR`` 0158 Zsh functions and autocompletion definitions (``zsh/site-functions``) 0159 Since 5.101 0160 0161 If ``KDE_INSTALL_USE_QT_SYS_PATHS`` is set to ``TRUE`` before including this 0162 module, the default values for some variables are instead queried from 0163 Qt5's qmake (where mentioned in the parentheses above). 0164 If not set, it will default to ``TRUE`` if Qt5's qmake is found and 0165 it's ``QT_INSTALL_PREFIX`` is the same as ``CMAKE_INSTALL_PREFIX``, 0166 otherwise default to ``FALSE``. 0167 This variable should NOT be set from within CMakeLists.txt files, instead 0168 is intended to be set manually when configuring a project which uses 0169 KDEInstallDirs (e.g. by packagers). 0170 0171 If ``KDE_INSTALL_DIRS_NO_DEPRECATED`` is set to ``TRUE`` before including this 0172 module, the deprecated variables (listed in the square brackets above) are 0173 not defined. 0174 0175 In addition, for each ``KDE_INSTALL_*`` variable, an equivalent 0176 ``CMAKE_INSTALL_*`` variable is defined. If 0177 ``KDE_INSTALL_DIRS_NO_DEPRECATED`` is set to ``TRUE``, only those variables 0178 defined by the ``GNUInstallDirs`` module (shipped with CMake) are defined. 0179 If ``KDE_INSTALL_DIRS_NO_CMAKE_VARIABLES`` is set to ``TRUE``, no variables with 0180 a ``CMAKE_`` prefix will be defined by this module (other than 0181 ``CMAKE_INSTALL_DEFAULT_COMPONENT_NAME`` - see below). 0182 0183 The ``KDE_INSTALL_<dir>`` variables (or their ``CMAKE_INSTALL_<dir>`` or 0184 deprecated counterparts) may be passed to the ``DESTINATION`` options of 0185 ``install()`` commands for the corresponding file type. They are set in the 0186 CMake cache, and so the defaults above can be overridden by users. 0187 0188 Note that the ``KDE_INSTALL_<dir>``, ``CMAKE_INSTALL_<dir>`` or deprecated 0189 form of the variable can be changed using CMake command line variable 0190 definitions; in either case, all forms of the variable will be affected. The 0191 effect of passing multiple forms of the same variable on the command line 0192 (such as ``KDE_INSTALL_BINDIR`` and ``CMAKE_INSTALL_BINDIR`` is undefined. 0193 0194 The variable ``KDE_INSTALL_TARGETS_DEFAULT_ARGS`` is also defined (along with 0195 the deprecated form ``INSTALL_TARGETS_DEFAULT_ARGS``). This should be used 0196 when libraries or user-executable applications are installed, in the 0197 following manner: 0198 0199 .. code-block:: cmake 0200 0201 install(TARGETS mylib myapp ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) 0202 0203 It MUST NOT be used for installing plugins, system admin executables or 0204 executables only intended for use internally by other code. Those should use 0205 ``KDE_INSTALL_PLUGINDIR``, ``KDE_INSTALL_SBINDIR`` or 0206 ``KDE_INSTALL_LIBEXECDIR`` respectively. 0207 0208 Additionally, ``CMAKE_INSTALL_DEFAULT_COMPONENT_NAME`` will be set to 0209 ``${PROJECT_NAME}`` to provide a sensible default for this CMake option. 0210 0211 Note that mixing absolute and relative paths, particularly for ``BINDIR``, 0212 ``LIBDIR`` and ``INCLUDEDIR``, can cause issues with exported targets. Given 0213 that the default values for these are relative paths, relative paths should 0214 be used on the command line when possible (eg: use 0215 ``-DKDE_INSTALL_LIBDIR=lib64`` instead of 0216 ``-DKDE_INSTALL_LIBDIR=/usr/lib/lib64`` to override the library directory). 0217 0218 Since 5.82.0, prior to that available as :kde-module:`KDEInstallDirs`. 0219 0220 NB: The variables starting ``KDE_INSTALL_`` are available since 1.6.0, 0221 unless otherwise noted with the variable. 0222 0223 The ``KDE_INSTALL_PREFIX_SCRIPT`` option will install a ${CMAKE_INSTALL_PREFIX}/prefix.sh 0224 file that allows to easily incorporate the necessary environment variables 0225 for the prefix into a process. 0226 0227 #]=======================================================================] 0228 0229 include(${CMAKE_CURRENT_LIST_DIR}/KDEInstallDirsCommon.cmake) 0230 0231 if(WIN32) 0232 _define_non_cache(LIBEXECDIR_KF5 "${CMAKE_INSTALL_LIBEXECDIR}") 0233 else() 0234 _define_non_cache(LIBEXECDIR_KF5 "${CMAKE_INSTALL_LIBEXECDIR}/kf5") 0235 endif() 0236 if(NOT KDE_INSTALL_DIRS_NO_DEPRECATED) 0237 set(KF5_LIBEXEC_INSTALL_DIR "${CMAKE_INSTALL_LIBEXECDIR_KF5}") 0238 endif() 0239 0240 include("${ECM_MODULE_DIR}/ECMQueryQt.cmake") 0241 0242 set(_default_KDE_INSTALL_USE_QT_SYS_PATHS OFF) 0243 if(NOT DEFINED KDE_INSTALL_USE_QT_SYS_PATHS) 0244 ecm_query_qt(qt_install_prefix_dir QT_INSTALL_PREFIX TRY) 0245 if(qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}") 0246 message(STATUS "Installing in the same prefix as Qt, adopting their path scheme.") 0247 set(_default_KDE_INSTALL_USE_QT_SYS_PATHS ON) 0248 endif() 0249 endif() 0250 0251 option (KDE_INSTALL_USE_QT_SYS_PATHS "Install mkspecs files, QCH files for Qt-based libs, Plugins and Imports to the Qt 5 install dir" "${_default_KDE_INSTALL_USE_QT_SYS_PATHS}") 0252 if(KDE_INSTALL_USE_QT_SYS_PATHS) 0253 # Qt-specific vars 0254 ecm_query_qt(qt_install_prefix_dir QT_INSTALL_PREFIX TRY) 0255 ecm_query_qt(qt_plugins_dir QT_INSTALL_PLUGINS) 0256 0257 if(qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}") 0258 file(RELATIVE_PATH qt_plugins_dir ${qt_install_prefix_dir} ${qt_plugins_dir}) 0259 endif() 0260 _define_absolute(QTPLUGINDIR ${qt_plugins_dir} 0261 "Qt plugins" 0262 QT_PLUGIN_INSTALL_DIR) 0263 0264 ecm_query_qt(qt_imports_dir QT_INSTALL_IMPORTS) 0265 0266 if(qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}") 0267 file(RELATIVE_PATH qt_imports_dir ${qt_install_prefix_dir} ${qt_imports_dir}) 0268 endif() 0269 _define_absolute(QTQUICKIMPORTSDIR ${qt_imports_dir} 0270 "QtQuick1 imports" 0271 IMPORTS_INSTALL_DIR) 0272 0273 ecm_query_qt(qt_qml_dir QT_INSTALL_QML) 0274 0275 if(qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}") 0276 file(RELATIVE_PATH qt_qml_dir ${qt_install_prefix_dir} ${qt_qml_dir}) 0277 endif() 0278 _define_absolute(QMLDIR ${qt_qml_dir} 0279 "QtQuick2 imports" 0280 QML_INSTALL_DIR) 0281 else() 0282 set(_pluginsDirParent LIBDIR) 0283 if (ANDROID) 0284 set(_pluginsDirParent) 0285 #androiddeployqt wants plugins right in the prefix 0286 endif() 0287 _define_relative(QTPLUGINDIR "${_pluginsDirParent}" "plugins" 0288 "Qt plugins" 0289 QT_PLUGIN_INSTALL_DIR) 0290 0291 _define_relative(QTQUICKIMPORTSDIR QTPLUGINDIR "imports" 0292 "QtQuick1 imports" 0293 IMPORTS_INSTALL_DIR) 0294 0295 _define_relative(QMLDIR LIBDIR "qml" 0296 "QtQuick2 imports" 0297 QML_INSTALL_DIR) 0298 endif() 0299 0300 _define_relative(PLUGINDIR QTPLUGINDIR "" 0301 "Plugins" 0302 PLUGIN_INSTALL_DIR) 0303 0304 _define_non_cache(INCLUDEDIR_KF5 "${CMAKE_INSTALL_INCLUDEDIR}/KF5") 0305 if(NOT KDE_INSTALL_DIRS_NO_DEPRECATED) 0306 set(KF5_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR_KF5}") 0307 endif() 0308 0309 0310 _define_non_cache(DATADIR_KF5 "${CMAKE_INSTALL_DATADIR}/kf5") 0311 if(NOT KDE_INSTALL_DIRS_NO_DEPRECATED) 0312 set(KF5_DATA_INSTALL_DIR "${CMAKE_INSTALL_DATADIR_KF5}") 0313 endif() 0314 0315 # Qt-specific data vars 0316 if(KDE_INSTALL_USE_QT_SYS_PATHS) 0317 ecm_query_qt(qt_docs_dir QT_INSTALL_DOCS) 0318 0319 _define_absolute(QTQCHDIR ${qt_docs_dir} 0320 "documentation bundles in QCH format for Qt-extending libraries") 0321 else() 0322 _define_relative(QTQCHDIR DATAROOTDIR "doc/qch" 0323 "documentation bundles in QCH format for Qt-extending libraries") 0324 endif() 0325 0326 0327 # KDE Framework-specific things 0328 _define_relative(KSERVICES5DIR DATAROOTDIR "kservices5" 0329 "services for KDE Frameworks 5" 0330 SERVICES_INSTALL_DIR KSERVICESDIR) 0331 _define_relative(KSERVICETYPES5DIR DATAROOTDIR "kservicetypes5" 0332 "service types for KDE Frameworks 5" 0333 SERVICETYPES_INSTALL_DIR KSERVICETYPESDIR) 0334 _define_relative(KNOTIFY5RCDIR DATAROOTDIR "knotifications5" 0335 "knotify description files" 0336 KNOTIFYRC_INSTALL_DIR KNOTIFYRCDIR) 0337 _define_relative(KXMLGUI5DIR DATAROOTDIR "kxmlgui5" 0338 "kxmlgui .rc files" 0339 KXMLGUI_INSTALL_DIR KXMLGUIDIR) 0340 _define_relative(LOGGINGCATEGORIESDIR DATAROOTDIR "qlogging-categories5" 0341 "Qt Logging categories files") 0342 0343 0344 # For more documentation see above. 0345 # Later on it will be possible to extend this for installing OSX frameworks 0346 # The COMPONENT Devel argument has the effect that static libraries belong to the 0347 # "Devel" install component. If we use this also for all install() commands 0348 # for header files, it will be possible to install 0349 # -everything: make install OR cmake -P cmake_install.cmake 0350 # -only the development files: cmake -DCOMPONENT=Devel -P cmake_install.cmake 0351 # -everything except the development files: cmake -DCOMPONENT=Unspecified -P cmake_install.cmake 0352 # This can then also be used for packaging with cpack. 0353 set(KDE_INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" 0354 LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" 0355 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT Devel 0356 INCLUDES DESTINATION "${KDE_INSTALL_INCLUDEDIR}" 0357 ) 0358 if(APPLE) 0359 set(KDE_INSTALL_TARGETS_DEFAULT_ARGS ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} 0360 BUNDLE DESTINATION "${BUNDLE_INSTALL_DIR}" ) 0361 endif() 0362 0363 set(KF5_INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" 0364 LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" 0365 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT Devel 0366 INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR_KF5}" 0367 ) 0368 0369 # on the Mac support an extra install directory for application bundles 0370 if(APPLE) 0371 set(KF5_INSTALL_TARGETS_DEFAULT_ARGS ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} 0372 BUNDLE DESTINATION "${BUNDLE_INSTALL_DIR}" ) 0373 endif() 0374 0375 if(NOT KDE_INSTALL_DIRS_NO_DEPRECATED) 0376 set(INSTALL_TARGETS_DEFAULT_ARGS ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) 0377 endif() 0378 0379 # version-less forward compatibility variants, see also KDEInstallDirs6.cmake 0380 set(KF_INSTALL_TARGETS_DEFAULT_ARGS ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) 0381 _define_non_cache(INCLUDEDIR_KF "${KDE_INSTALL_INCLUDEDIR_KF5}") 0382 _define_non_cache(DATADIR_KF "${KDE_INSTALL_DATADIR_KF5}") 0383 _define_non_cache(LIBEXECDIR_KF "${KDE_INSTALL_LIBEXECDIR_KF5}") 0384 0385 include(${CMAKE_CURRENT_LIST_DIR}/KDESetupPrefixScript.cmake)