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 ``KSERVICESDIR``
0076     services for KDE Frameworks 6 (``DATAROOTDIR/kservices6``)
0077 ``KSERVICETYPESDIR``
0078     service types for KDE Frameworks 6 (``DATAROOTDIR/kservicetypes6``)
0079 ``KXMLGUIDIR``
0080     kxmlgui .rc files (``DATAROOTDIR/kxmlgui5``)
0081 ``KAPPTEMPLATESDIR``
0082     KAppTemplate and KDevelop templates (``DATAROOTDIR/kdevappwizard/templates``)
0083 ``KFILETEMPLATESDIR``
0084     KDevelop file templates (``DATAROOTDIR/kdevfiletemplates/templates``)
0085 ``KNOTIFYRCDIR``
0086     knotify description files (``DATAROOTDIR/knotifications6``)
0087 ``ICONDIR``
0088     icons (``DATAROOTDIR/icons``)
0089 ``LOCALEDIR``
0090     locale-dependent data (``DATAROOTDIR/locale``)
0091 ``SOUNDDIR``
0092     sound files (``DATAROOTDIR/sounds``)
0093 ``TEMPLATEDIR``
0094     templates (``DATAROOTDIR/templates``)
0095 ``WALLPAPERDIR``
0096     desktop wallpaper images (``DATAROOTDIR/wallpapers``)
0097 ``APPDIR``
0098     application desktop files (``DATAROOTDIR/applications``)
0099 ``DESKTOPDIR``
0100     desktop directories (``DATAROOTDIR/desktop-directories``)
0101 ``MIMEDIR``
0102     mime description files (``DATAROOTDIR/mime/packages``)
0103 ``METAINFODIR``
0104     AppStream component metadata files (``DATAROOTDIR/metainfo``)
0105 ``QTQCHDIR``
0106     documentation bundles in QCH format for Qt-extending libraries (``DATAROOTDIR/doc/qch`` or qmake-qt5's ``QT_INSTALL_DOCS``)
0107 ``QCHDIR``
0108     documentation bundles in QCH format (``DATAROOTDIR/doc/qch``)
0109 ``MANDIR``
0110     man documentation (``DATAROOTDIR/man``)
0111 ``INFODIR``
0112     info documentation (``DATAROOTDIR/info``)
0113 ``DBUSDIR``
0114     D-Bus (``DATAROOTDIR/dbus-1``)
0115 ``DBUSINTERFACEDIR``
0116     D-Bus interfaces (``DBUSDIR/interfaces``)
0117 ``DBUSSERVICEDIR``
0118     D-Bus session services (``DBUSDIR/services``)
0119 ``DBUSSYSTEMSERVICEDIR``
0120     D-Bus system services (``DBUSDIR/system-services``)
0121 ``SYSCONFDIR``
0122     read-only single-machine data
0123     (``etc``, or ``/etc`` if ``CMAKE_INSTALL_PREFIX`` is ``/usr``)
0124 ``CONFDIR``
0125     application configuration files (``SYSCONFDIR/xdg``)
0126 ``AUTOSTARTDIR``
0127     autostart files (``CONFDIR/autostart``)
0128 ``LOGGINGCATEGORIESDIR``
0129     Qt logging categories files directory (``DATAROOTDIR/qlogging-categories6``)
0130 ``JARDIR``
0131     Java AAR/JAR files for Android.
0132 ``SYSTEMDUNITDIR``
0133     Systemd Units (``lib/systemd``)
0134 ``SYSTEMDUSERUNITDIR``
0135     Systemd User Units (``lib/systemd/user``)
0136 
0137 If ``KDE_INSTALL_USE_QT_SYS_PATHS`` is set to ``TRUE`` before including this
0138 module, the default values for some variables are instead queried from
0139 Qt6's qmake (where mentioned in the parentheses above).
0140 If not set, it will default to ``TRUE`` if Qt6's qmake is found and
0141 it's ``QT_INSTALL_PREFIX`` is the same as ``CMAKE_INSTALL_PREFIX``,
0142 otherwise default to ``FALSE``.
0143 This variable should NOT be set from within CMakeLists.txt files, instead
0144 is intended to be set manually when configuring a project which uses
0145 KDEInstallDirs (e.g. by packagers).
0146 
0147 In addition, for each ``KDE_INSTALL_*`` variable, an equivalent
0148 ``CMAKE_INSTALL_*`` variable is defined, if such a variable is also
0149 defined by the ``GNUInstallDirs`` module (shipped with CMake).
0150 If ``KDE_INSTALL_DIRS_NO_CMAKE_VARIABLES`` is set to ``TRUE``, no variables with
0151 a ``CMAKE_`` prefix will be defined by this module (other than
0152 ``CMAKE_INSTALL_DEFAULT_COMPONENT_NAME`` - see below).
0153 
0154 The ``KDE_INSTALL_<dir>`` variables may be passed to the ``DESTINATION`` options of
0155 ``install()`` commands for the corresponding file type.  They are set in the
0156 CMake cache, and so the defaults above can be overridden by users.
0157 
0158 Note that the ``KDE_INSTALL_<dir>`` or ``CMAKE_INSTALL_<dir>`` variables
0159 can be changed using CMake command line variable definitions; in either case,
0160 both forms of the variable will be affected. The effect of passing multiple
0161 forms of the same variable on the command line
0162 (such as ``KDE_INSTALL_BINDIR`` and ``CMAKE_INSTALL_BINDIR`` is undefined.
0163 
0164 The variable ``KDE_INSTALL_TARGETS_DEFAULT_ARGS`` is also defined.
0165 This should be used when libraries or user-executable applications are installed,
0166 in the following manner:
0167 
0168 .. code-block:: cmake
0169 
0170   install(TARGETS mylib myapp ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
0171 
0172 It MUST NOT be used for installing plugins, system admin executables or
0173 executables only intended for use internally by other code.  Those should use
0174 ``KDE_INSTALL_PLUGINDIR``, ``KDE_INSTALL_SBINDIR`` or
0175 ``KDE_INSTALL_LIBEXECDIR`` respectively.
0176 
0177 Additionally, ``CMAKE_INSTALL_DEFAULT_COMPONENT_NAME`` will be set to
0178 ``${PROJECT_NAME}`` to provide a sensible default for this CMake option.
0179 
0180 Note that mixing absolute and relative paths, particularly for ``BINDIR``,
0181 ``LIBDIR`` and ``INCLUDEDIR``, can cause issues with exported targets. Given
0182 that the default values for these are relative paths, relative paths should
0183 be used on the command line when possible (eg: use
0184 ``-DKDE_INSTALL_LIBDIR=lib64`` instead of
0185 ``-DKDE_INSTALL_LIBDIR=/usr/lib/lib64`` to override the library directory).
0186 
0187 The ``KDE_INSTALL_PREFIX_SCRIPT`` option will install a ${CMAKE_INSTALL_PREFIX}/prefix.sh
0188 file that allows to easily incorporate the necessary environment variables
0189 for the prefix into a process.
0190 #]=======================================================================]
0191 
0192 set(KDE_INSTALL_DIRS_NO_DEPRECATED TRUE)
0193 
0194 include(${CMAKE_CURRENT_LIST_DIR}/KDEInstallDirsCommon.cmake)
0195 
0196 if(WIN32)
0197     _define_non_cache(LIBEXECDIR_KF "${CMAKE_INSTALL_LIBEXECDIR}")
0198 else()
0199     _define_non_cache(LIBEXECDIR_KF "${CMAKE_INSTALL_LIBEXECDIR}/kf6")
0200 endif()
0201 
0202 include(${ECM_MODULE_DIR}/ECMQueryQt.cmake)
0203 ecm_query_qt(qt_install_prefix_dir QT_INSTALL_PREFIX)
0204 
0205 set(_qt_prefix_is_cmake_install_prefix FALSE)
0206 if(qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}")
0207     set(_qt_prefix_is_cmake_install_prefix TRUE)
0208 endif()
0209 
0210 set(_default_KDE_INSTALL_USE_QT_SYS_PATHS OFF)
0211 if(NOT DEFINED KDE_INSTALL_USE_QT_SYS_PATHS)
0212     if(_qt_prefix_is_cmake_install_prefix)
0213        message(STATUS "Installing in the same prefix as Qt, adopting their path scheme.")
0214        set(_default_KDE_INSTALL_USE_QT_SYS_PATHS ON)
0215     endif()
0216 endif()
0217 
0218 option (KDE_INSTALL_USE_QT_SYS_PATHS
0219         "Install mkspecs files, QCH files for Qt-based libs, Plugins and Imports to the Qt 6 install dir"
0220         "${_default_KDE_INSTALL_USE_QT_SYS_PATHS}"
0221 )
0222 
0223 if(KDE_INSTALL_USE_QT_SYS_PATHS)
0224    # Qt-specific vars
0225     ecm_query_qt(qt_plugins_dir QT_INSTALL_PLUGINS)
0226     if(_qt_prefix_is_cmake_install_prefix)
0227         file(RELATIVE_PATH qt_plugins_dir ${qt_install_prefix_dir} ${qt_plugins_dir})
0228     endif()
0229     _define_absolute(QTPLUGINDIR ${qt_plugins_dir} "Qt plugins")
0230 
0231     ecm_query_qt(qt_qml_dir QT_INSTALL_QML)
0232     if(_qt_prefix_is_cmake_install_prefix)
0233         file(RELATIVE_PATH qt_qml_dir ${qt_install_prefix_dir} ${qt_qml_dir})
0234     endif()
0235    _define_absolute(QMLDIR ${qt_qml_dir} "QtQuick2 imports")
0236 else()
0237     set(_pluginsDirParent LIBDIR)
0238     if (ANDROID)
0239         set(_pluginsDirParent)
0240         #androiddeployqt wants plugins right in the prefix
0241     endif()
0242     _define_relative(QTPLUGINDIR "${_pluginsDirParent}" "plugins"
0243         "Qt plugins")
0244 
0245     _define_relative(QMLDIR LIBDIR "qml"
0246         "QtQuick2 imports")
0247 endif()
0248 
0249 _define_relative(PLUGINDIR QTPLUGINDIR ""
0250     "Plugins")
0251 
0252 _define_non_cache(INCLUDEDIR_KF "${CMAKE_INSTALL_INCLUDEDIR}/KF6")
0253 
0254 _define_non_cache(DATADIR_KF "${CMAKE_INSTALL_DATADIR}/kf6")
0255 
0256 # Qt-specific data vars
0257 if(KDE_INSTALL_USE_QT_SYS_PATHS)
0258     ecm_query_qt(qt_docs_dir QT_INSTALL_DOCS)
0259 
0260    _define_absolute(QTQCHDIR ${qt_docs_dir} "documentation bundles in QCH format for Qt-extending libraries")
0261 else()
0262     _define_relative(QTQCHDIR DATAROOTDIR "doc/qch"
0263         "documentation bundles in QCH format for Qt-extending libraries")
0264 endif()
0265 
0266 
0267 # KDE Framework-specific things
0268 _define_relative(KSERVICESDIR DATAROOTDIR "kservices6"
0269     "services for KDE Frameworks 6")
0270 _define_relative(KSERVICETYPESDIR DATAROOTDIR "kservicetypes6"
0271     "service types for KDE Frameworks 6")
0272 _define_relative(KNOTIFYRCDIR DATAROOTDIR "knotifications6"
0273     "knotify description files")
0274 # TODO MOVE TO KXMLGUI
0275 _define_relative(KXMLGUIDIR DATAROOTDIR "kxmlgui5"
0276     "kxmlgui .rc files")
0277 _define_relative(LOGGINGCATEGORIESDIR DATAROOTDIR "qlogging-categories6"
0278     "Qt Logging categories files")
0279 
0280 # For more documentation see above.
0281 # Later on it will be possible to extend this for installing OSX frameworks
0282 # The COMPONENT Devel argument has the effect that static libraries belong to the
0283 # "Devel" install component. If we use this also for all install() commands
0284 # for header files, it will be possible to install
0285 #   -everything: make install OR cmake -P cmake_install.cmake
0286 #   -only the development files: cmake -DCOMPONENT=Devel -P cmake_install.cmake
0287 #   -everything except the development files: cmake -DCOMPONENT=Unspecified -P cmake_install.cmake
0288 # This can then also be used for packaging with cpack.
0289 set(KDE_INSTALL_TARGETS_DEFAULT_ARGS  RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
0290                                       LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
0291                                       ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT Devel
0292 )
0293 if(APPLE)
0294     set(KDE_INSTALL_TARGETS_DEFAULT_ARGS  ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}
0295                                           BUNDLE DESTINATION "${BUNDLE_INSTALL_DIR}" )
0296 endif()
0297 
0298 set(KF_INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
0299                                     LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
0300                                     ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT Devel
0301 )
0302 
0303 # on the Mac support an extra install directory for application bundles
0304 if(APPLE)
0305     set(KF_INSTALL_TARGETS_DEFAULT_ARGS  ${KF_INSTALL_TARGETS_DEFAULT_ARGS}
0306                                           BUNDLE DESTINATION "${BUNDLE_INSTALL_DIR}" )
0307 endif()
0308 
0309 include(${CMAKE_CURRENT_LIST_DIR}/KDESetupPrefixScript.cmake)