Warning, /frameworks/extra-cmake-modules/kde-modules/KDEInstallDirs6.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 # SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
0008 # SPDX-FileCopyrightText: 2021 Ahmad Samir <a.samir78@gmail.com>
0009 #
0010 # SPDX-License-Identifier: BSD-3-Clause
0011 
0012 #[=======================================================================[.rst:
0013 KDEInstallDirs6
0014 ---------------
0015 
0016 THIS IS CURRENTLY ONLY AN ALPHA VERSION, FOR FRAMEWORKS USAGE ONLY,
0017 AND TO BE MODIFIED INCREMENTALLY. PLEASE DO NOT USE IN APPLICATIONS YET.
0018 
0019 Define KDE standard installation directories for Qt6/KF6 based software.
0020 
0021 Note that none of the variables defined by this module provide any
0022 information about the location of already-installed KDE software.
0023 
0024 Also sets ``CMAKE_INSTALL_PREFIX`` to the installation prefix of ECM,
0025 unless that variable has been already explicitly set by something else.
0026 
0027 Inclusion of this module defines the following variables:
0028 
0029 ``KDE_INSTALL_<dir>``
0030     destination for files of a given type
0031 ``KDE_INSTALL_FULL_<dir>``
0032     corresponding absolute path
0033 
0034 where ``<dir>`` is one of (default values in parentheses):
0035 
0036 ``BUNDLEDIR``
0037     application bundles (``/Applications/KDE``)
0038 ``EXECROOTDIR``
0039     executables and libraries (``<empty>``)
0040 ``BINDIR``
0041     user executables (``EXECROOTDIR/bin``)
0042 ``SBINDIR``
0043     system admin executables (``EXECROOTDIR/sbin``)
0044 ``LIBDIR``
0045     object code libraries (``EXECROOTDIR/lib``, ``EXECROOTDIR/lib64`` or
0046     ``EXECROOTDIR/lib/<multiarch-tuple`` on Debian)
0047 ``LIBEXECDIR``
0048     executables for internal use by programs and libraries (``BINDIR`` on
0049     Windows, ``LIBDIR/libexec`` otherwise)
0050 ``CMAKEPACKAGEDIR``
0051     CMake packages, including config files (``LIBDIR/cmake``)
0052 ``QTPLUGINDIR``
0053     Qt plugins (``LIBDIR/plugins`` or qmake-qt5's ``QT_INSTALL_PLUGINS``)
0054 ``PLUGINDIR``
0055     Plugins (``QTPLUGINDIR``) [``PLUGIN_INSTALL_DIR``]
0056 ``QMLDIR``
0057     QtQuick2 imports (``LIBDIR/qml`` or qmake-qt5's ``QT_INSTALL_QML``)
0058 ``INCLUDEDIR``
0059     C and C++ header files (``include``)
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 ``DATADIR``
0067     read-only architecture-independent data (``DATAROOTDIR``)
0068 ``DOCBUNDLEDIR``
0069     documentation bundles generated using kdoctools
0070     (``DATAROOTDIR/doc/HTML``)
0071 ``KCFGDIR``
0072     kconfig description files (``DATAROOTDIR/config.kcfg``)
0073 ``KCONFUPDATEDIR``
0074     kconf_update scripts (``DATAROOTDIR/kconf_update``)
0075 ``KXMLGUIDIR``
0076     kxmlgui .rc files (``DATAROOTDIR/kxmlgui5``)
0077 ``KAPPTEMPLATESDIR``
0078     KAppTemplate and KDevelop templates (``DATAROOTDIR/kdevappwizard/templates``)
0079 ``KFILETEMPLATESDIR``
0080     KDevelop file templates (``DATAROOTDIR/kdevfiletemplates/templates``)
0081 ``KNOTIFYRCDIR``
0082     knotify description files (``DATAROOTDIR/knotifications6``)
0083 ``ICONDIR``
0084     icons (``DATAROOTDIR/icons``)
0085 ``LOCALEDIR``
0086     locale-dependent data (``DATAROOTDIR/locale``)
0087 ``SOUNDDIR``
0088     sound files (``DATAROOTDIR/sounds``)
0089 ``TEMPLATEDIR``
0090     templates (``DATAROOTDIR/templates``)
0091 ``WALLPAPERDIR``
0092     desktop wallpaper images (``DATAROOTDIR/wallpapers``)
0093 ``APPDIR``
0094     application desktop files (``DATAROOTDIR/applications``)
0095 ``DESKTOPDIR``
0096     desktop directories (``DATAROOTDIR/desktop-directories``)
0097 ``MIMEDIR``
0098     mime description files (``DATAROOTDIR/mime/packages``)
0099 ``METAINFODIR``
0100     AppStream component metadata files (``DATAROOTDIR/metainfo``)
0101 ``QTQCHDIR``
0102     documentation bundles in QCH format for Qt-extending libraries (``DATAROOTDIR/doc/qch`` or qmake-qt5's ``QT_INSTALL_DOCS``)
0103 ``QCHDIR``
0104     documentation bundles in QCH format (``DATAROOTDIR/doc/qch``)
0105 ``MANDIR``
0106     man documentation (``DATAROOTDIR/man``)
0107 ``INFODIR``
0108     info documentation (``DATAROOTDIR/info``)
0109 ``DBUSDIR``
0110     D-Bus (``DATAROOTDIR/dbus-1``)
0111 ``DBUSINTERFACEDIR``
0112     D-Bus interfaces (``DBUSDIR/interfaces``)
0113 ``DBUSSERVICEDIR``
0114     D-Bus session services (``DBUSDIR/services``)
0115 ``DBUSSYSTEMSERVICEDIR``
0116     D-Bus system services (``DBUSDIR/system-services``)
0117 ``SYSCONFDIR``
0118     read-only single-machine data
0119     (``etc``, or ``/etc`` if ``CMAKE_INSTALL_PREFIX`` is ``/usr``)
0120 ``CONFDIR``
0121     application configuration files (``SYSCONFDIR/xdg``)
0122 ``AUTOSTARTDIR``
0123     autostart files (``CONFDIR/autostart``)
0124 ``LOGGINGCATEGORIESDIR``
0125     Qt logging categories files directory (``DATAROOTDIR/qlogging-categories6``)
0126 ``JARDIR``
0127     Java AAR/JAR files for Android.
0128 ``SYSTEMDUNITDIR``
0129     Systemd Units (``lib/systemd``)
0130 ``SYSTEMDUSERUNITDIR``
0131     Systemd User Units (``lib/systemd/user``)
0132 
0133 If ``KDE_INSTALL_USE_QT_SYS_PATHS`` is set to ``TRUE`` before including this
0134 module, the default values for some variables are instead queried from
0135 Qt6's qmake (where mentioned in the parentheses above).
0136 If not set, it will default to ``TRUE`` if Qt6's qmake is found and
0137 it's ``QT_INSTALL_PREFIX`` is the same as ``CMAKE_INSTALL_PREFIX``,
0138 otherwise default to ``FALSE``.
0139 This variable should NOT be set from within CMakeLists.txt files, instead
0140 is intended to be set manually when configuring a project which uses
0141 KDEInstallDirs (e.g. by packagers).
0142 
0143 In addition, for each ``KDE_INSTALL_*`` variable, an equivalent
0144 ``CMAKE_INSTALL_*`` variable is defined, if such a variable is also
0145 defined by the ``GNUInstallDirs`` module (shipped with CMake).
0146 If ``KDE_INSTALL_DIRS_NO_CMAKE_VARIABLES`` is set to ``TRUE``, no variables with
0147 a ``CMAKE_`` prefix will be defined by this module (other than
0148 ``CMAKE_INSTALL_DEFAULT_COMPONENT_NAME`` - see below).
0149 
0150 The ``KDE_INSTALL_<dir>`` variables may be passed to the ``DESTINATION`` options of
0151 ``install()`` commands for the corresponding file type.  They are set in the
0152 CMake cache, and so the defaults above can be overridden by users.
0153 
0154 Note that the ``KDE_INSTALL_<dir>`` or ``CMAKE_INSTALL_<dir>`` variables
0155 can be changed using CMake command line variable definitions; in either case,
0156 both forms of the variable will be affected. The effect of passing multiple
0157 forms of the same variable on the command line
0158 (such as ``KDE_INSTALL_BINDIR`` and ``CMAKE_INSTALL_BINDIR`` is undefined.
0159 
0160 The variable ``KDE_INSTALL_TARGETS_DEFAULT_ARGS`` is also defined.
0161 This should be used when libraries or user-executable applications are installed,
0162 in the following manner:
0163 
0164 .. code-block:: cmake
0165 
0166   install(TARGETS mylib myapp ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
0167 
0168 It MUST NOT be used for installing plugins, system admin executables or
0169 executables only intended for use internally by other code.  Those should use
0170 ``KDE_INSTALL_PLUGINDIR``, ``KDE_INSTALL_SBINDIR`` or
0171 ``KDE_INSTALL_LIBEXECDIR`` respectively.
0172 
0173 Additionally, ``CMAKE_INSTALL_DEFAULT_COMPONENT_NAME`` will be set to
0174 ``${PROJECT_NAME}`` to provide a sensible default for this CMake option.
0175 
0176 Note that mixing absolute and relative paths, particularly for ``BINDIR``,
0177 ``LIBDIR`` and ``INCLUDEDIR``, can cause issues with exported targets. Given
0178 that the default values for these are relative paths, relative paths should
0179 be used on the command line when possible (eg: use
0180 ``-DKDE_INSTALL_LIBDIR=lib64`` instead of
0181 ``-DKDE_INSTALL_LIBDIR=/usr/lib/lib64`` to override the library directory).
0182 
0183 The ``KDE_INSTALL_PREFIX_SCRIPT`` option will install a ${CMAKE_INSTALL_PREFIX}/prefix.sh
0184 file that allows to easily incorporate the necessary environment variables
0185 for the prefix into a process.
0186 #]=======================================================================]
0187 
0188 set(KDE_INSTALL_DIRS_NO_DEPRECATED TRUE)
0189 
0190 include(${CMAKE_CURRENT_LIST_DIR}/KDEInstallDirsCommon.cmake)
0191 
0192 if(WIN32)
0193     _define_non_cache(LIBEXECDIR_KF "${CMAKE_INSTALL_LIBEXECDIR}")
0194 else()
0195     _define_non_cache(LIBEXECDIR_KF "${CMAKE_INSTALL_LIBEXECDIR}/kf6")
0196 endif()
0197 
0198 include(${ECM_MODULE_DIR}/ECMQueryQt.cmake)
0199 ecm_query_qt(qt_install_prefix_dir QT_INSTALL_PREFIX)
0200 
0201 set(_qt_prefix_is_cmake_install_prefix FALSE)
0202 if(qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}")
0203     set(_qt_prefix_is_cmake_install_prefix TRUE)
0204 endif()
0205 
0206 set(_default_KDE_INSTALL_USE_QT_SYS_PATHS OFF)
0207 if(NOT DEFINED KDE_INSTALL_USE_QT_SYS_PATHS)
0208     if(_qt_prefix_is_cmake_install_prefix)
0209        message(STATUS "Installing in the same prefix as Qt, adopting their path scheme.")
0210        set(_default_KDE_INSTALL_USE_QT_SYS_PATHS ON)
0211     endif()
0212 endif()
0213 
0214 option (KDE_INSTALL_USE_QT_SYS_PATHS
0215         "Install mkspecs files, QCH files for Qt-based libs, Plugins and Imports to the Qt 6 install dir"
0216         "${_default_KDE_INSTALL_USE_QT_SYS_PATHS}"
0217 )
0218 
0219 if(KDE_INSTALL_USE_QT_SYS_PATHS)
0220    # Qt-specific vars
0221     ecm_query_qt(qt_plugins_dir QT_INSTALL_PLUGINS)
0222     if(_qt_prefix_is_cmake_install_prefix)
0223         file(RELATIVE_PATH qt_plugins_dir ${qt_install_prefix_dir} ${qt_plugins_dir})
0224     endif()
0225     _define_absolute(QTPLUGINDIR ${qt_plugins_dir} "Qt plugins")
0226 
0227     ecm_query_qt(qt_qml_dir QT_INSTALL_QML)
0228     if(_qt_prefix_is_cmake_install_prefix)
0229         file(RELATIVE_PATH qt_qml_dir ${qt_install_prefix_dir} ${qt_qml_dir})
0230     endif()
0231    _define_absolute(QMLDIR ${qt_qml_dir} "QtQuick2 imports")
0232 else()
0233     set(_pluginsDirParent LIBDIR)
0234     if (ANDROID)
0235         set(_pluginsDirParent)
0236         #androiddeployqt wants plugins right in the prefix
0237     endif()
0238     _define_relative(QTPLUGINDIR "${_pluginsDirParent}" "plugins"
0239         "Qt plugins")
0240 
0241     _define_relative(QMLDIR LIBDIR "qml"
0242         "QtQuick2 imports")
0243 endif()
0244 
0245 _define_relative(PLUGINDIR QTPLUGINDIR ""
0246     "Plugins")
0247 
0248 _define_non_cache(INCLUDEDIR_KF "${CMAKE_INSTALL_INCLUDEDIR}/KF6")
0249 
0250 _define_non_cache(DATADIR_KF "${CMAKE_INSTALL_DATADIR}/kf6")
0251 
0252 # Qt-specific data vars
0253 if(KDE_INSTALL_USE_QT_SYS_PATHS)
0254     ecm_query_qt(qt_docs_dir QT_INSTALL_DOCS)
0255 
0256    _define_absolute(QTQCHDIR ${qt_docs_dir} "documentation bundles in QCH format for Qt-extending libraries")
0257 else()
0258     _define_relative(QTQCHDIR DATAROOTDIR "doc/qch"
0259         "documentation bundles in QCH format for Qt-extending libraries")
0260 endif()
0261 
0262 
0263 # KDE Framework-specific things
0264 _define_relative(KNOTIFYRCDIR DATAROOTDIR "knotifications6"
0265     "knotify description files")
0266 # TODO MOVE TO KXMLGUI
0267 _define_relative(KXMLGUIDIR DATAROOTDIR "kxmlgui5"
0268     "kxmlgui .rc files")
0269 _define_relative(LOGGINGCATEGORIESDIR DATAROOTDIR "qlogging-categories6"
0270     "Qt Logging categories files")
0271 
0272 # For more documentation see above.
0273 # Later on it will be possible to extend this for installing OSX frameworks
0274 # The COMPONENT Devel argument has the effect that static libraries belong to the
0275 # "Devel" install component. If we use this also for all install() commands
0276 # for header files, it will be possible to install
0277 #   -everything: make install OR cmake -P cmake_install.cmake
0278 #   -only the development files: cmake -DCOMPONENT=Devel -P cmake_install.cmake
0279 #   -everything except the development files: cmake -DCOMPONENT=Unspecified -P cmake_install.cmake
0280 # This can then also be used for packaging with cpack.
0281 set(KDE_INSTALL_TARGETS_DEFAULT_ARGS  RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
0282                                       LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
0283                                       ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT Devel
0284 )
0285 if(APPLE)
0286     set(KDE_INSTALL_TARGETS_DEFAULT_ARGS  ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}
0287                                           BUNDLE DESTINATION "${KDE_INSTALL_BUNDLEDIR}" )
0288 endif()
0289 
0290 set(KF_INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
0291                                     LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
0292                                     ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT Devel
0293 )
0294 
0295 # on the Mac support an extra install directory for application bundles
0296 if(APPLE)
0297     set(KF_INSTALL_TARGETS_DEFAULT_ARGS  ${KF_INSTALL_TARGETS_DEFAULT_ARGS}
0298                                           BUNDLE DESTINATION "${KDE_INSTALL_BUNDLEDIR}" )
0299 endif()
0300 
0301 include(${CMAKE_CURRENT_LIST_DIR}/KDESetupPrefixScript.cmake)