Introduce INSTALL_QT_SHAREDIR

Normally `INSTALL_DATADIR` is the canonical place for
`share`/`CMAKE_INSTALL_DATADIR`, but this standard is not well
enforced.

In 834d92a, `INSTALL_SHAREDIR` was introduced to better enforce this
standard and allow to install into third-party program's
`CMAKE_INSTALL_DATADIR` (e.g. wayland). This ended up being used as
`INSTALL_SHAREDIR/qt6` instead, but this leaves little room for
configuration and renaming.

This change introduces a namespaced variant that is guaranteed to be
owned by Qt.

Pick-to: 6.10
Change-Id: I25c0e5b47c402b178120e9e628fdfaf4aaad27ad
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Cristian Le 2025-05-26 12:20:50 +02:00
parent d08f1d7dbc
commit cebdf1eb1c
4 changed files with 8 additions and 4 deletions

View File

@ -151,10 +151,10 @@ endmacro()
function(qt_internal_qtbase_install_wayland_files)
qt_path_join(wlprotocols_build_dir
${QT_BUILD_DIR}
${INSTALL_SHAREDIR}/qt6/wayland/protocols)
${INSTALL_QT_SHAREDIR}/wayland/protocols)
qt_path_join(wlprotocols_install_dir
${QT_INSTALL_DIR}
${INSTALL_SHAREDIR}/qt6/wayland/protocols)
${INSTALL_QT_SHAREDIR}/wayland/protocols)
file(GLOB wlprotocols_subdirs
LIST_DIRECTORIES TRUE
@ -178,10 +178,10 @@ function(qt_internal_qtbase_install_wayland_files)
qt_path_join(wlextensions_build_dir
${QT_BUILD_DIR}
${INSTALL_SHAREDIR}/qt6/wayland/extensions)
${INSTALL_QT_SHAREDIR}/wayland/extensions)
qt_path_join(wlextensions_install_dir
${QT_INSTALL_DIR}
${INSTALL_SHAREDIR}/qt6/wayland/extensions)
${INSTALL_QT_SHAREDIR}/wayland/extensions)
file(GLOB wlextensions_subdirs
LIST_DIRECTORIES TRUE

View File

@ -161,6 +161,8 @@ macro(qt_internal_setup_configure_install_paths)
qt_configure_process_path(INSTALL_LIBDIR "lib" "Libraries [PREFIX/lib]")
qt_configure_process_path(INSTALL_MKSPECSDIR "mkspecs" "Mkspecs files [PREFIX/mkspecs]")
qt_configure_process_path(INSTALL_SHAREDIR "share" "Share files [PREFIX/share]")
qt_configure_process_path(INSTALL_QT_SHAREDIR "${INSTALL_SHAREDIR}/qt6"
"Qt namespaced sharedir [SHAREDIR/qt6]")
qt_configure_process_path(INSTALL_ARCHDATADIR "." "Arch-dependent data [PREFIX]")
qt_configure_process_path(INSTALL_PLUGINSDIR
"${INSTALL_ARCHDATADIR}/plugins"

View File

@ -19,6 +19,7 @@ set(@var_prefix@EXAMPLESDIR "@INSTALL_EXAMPLESDIR@")
set(@var_prefix@TESTSDIR "@INSTALL_TESTSDIR@")
set(@var_prefix@DESCRIPTIONSDIR "@INSTALL_DESCRIPTIONSDIR@")
set(@var_prefix@SHAREDIR "@INSTALL_SHAREDIR@")
set(@var_prefix@QT_SHAREDIR "@INSTALL_QT_SHAREDIR@")
set(@var_prefix@QMAKE_MKSPEC "@QT_QMAKE_TARGET_MKSPEC@")
set(@var_prefix@ARCH "@TEST_architecture_arch@")
set(@var_prefix@SUBARCHS "@TEST_subarch_result@")

View File

@ -16,3 +16,4 @@ set(QT@PROJECT_VERSION_MAJOR@_INSTALL_TESTS "@INSTALL_TESTSDIR@")
set(QT@PROJECT_VERSION_MAJOR@_INSTALL_TRANSLATIONS "@INSTALL_TRANSLATIONSDIR@")
set(QT@PROJECT_VERSION_MAJOR@_INSTALL_DESCRIPTIONSDIR "@INSTALL_DESCRIPTIONSDIR@")
set(QT@PROJECT_VERSION_MAJOR@_INSTALL_SHAREDIR "@INSTALL_SHAREDIR@")
set(QT@PROJECT_VERSION_MAJOR@_INSTALL_QT_SHAREDIR "@INSTALL_QT_SHAREDIR@")