diff --git a/cmake/QtModuleHelpers.cmake b/cmake/QtModuleHelpers.cmake index 2c193aae05..0e61ecf37f 100644 --- a/cmake/QtModuleHelpers.cmake +++ b/cmake/QtModuleHelpers.cmake @@ -755,7 +755,7 @@ set(QT_LIBINFIX \"${QT_LIBINFIX}\")") if (NOT target_type STREQUAL "INTERFACE_LIBRARY") set(args "") if(QT_WILL_INSTALL) - set(metatypes_install_dir "${INSTALL_LIBDIR}/metatypes") + set(metatypes_install_dir "${INSTALL_ARCHDATADIR}/metatypes") list(APPEND args __QT_INTERNAL_INSTALL __QT_INTERNAL_INSTALL_DIR "${metatypes_install_dir}") endif() diff --git a/mkspecs/features/metatypes.prf b/mkspecs/features/metatypes.prf index c1f16fe3ab..d23b299403 100644 --- a/mkspecs/features/metatypes.prf +++ b/mkspecs/features/metatypes.prf @@ -46,7 +46,7 @@ moc_collect_json.name = Collect moc JSON output into central file install_metatypes { do_install_metatypes.CONFIG += no_check_exist - do_install_metatypes.path = $$[QT_INSTALL_LIBS]/metatypes + do_install_metatypes.path = $$[QT_INSTALL_ARCHDATA]/metatypes do_install_metatypes.files = $$OUT_PWD/$$MOC_COLLECT_JSON_OUTPUT prefix_build { load(qt_build_paths) diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index 9d7e1ecbdd..e8be8fab98 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -376,7 +376,7 @@ set_source_files_properties(${qobject_moc_files} PROPERTIES HEADER_FILE_ONLY ON) set(core_metatype_args MANUAL_MOC_JSON_FILES ${core_qobject_metatypes_json_list}) if(QT_WILL_INSTALL) - set(metatypes_install_dir ${INSTALL_LIBDIR}/metatypes) + set(metatypes_install_dir ${INSTALL_ARCHDATADIR}/metatypes) list(APPEND core_metatype_args __QT_INTERNAL_INSTALL __QT_INTERNAL_INSTALL_DIR "${metatypes_install_dir}") endif() diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index 19a75917a4..baf8fcb578 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -900,7 +900,7 @@ function(qt6_extract_metatypes target) # TODO: Move this into a separate internal function, so it doesn't pollute the public one. # Location where to install the metatypes file. Only used if # __QT_INTERNAL_INSTALL is given. It defaults to the - # ${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBDIR}/metatypes directory. + # ${CMAKE_INSTALL_PREFIX}/${INSTALL_ARCHDATADIR}/metatypes directory. # Executable metatypes files are never installed. __QT_INTERNAL_INSTALL_DIR @@ -1140,10 +1140,11 @@ function(qt6_extract_metatypes target) # Automatically fill default install args when not specified. if(NOT arg___QT_INTERNAL_INSTALL_DIR) - # INSTALL_LIBDIR is not set when QtBuildInternals is not loaded (when not doing a Qt build). - # Default to a hardcoded location for user projects. - if(INSTALL_LIBDIR) - set(install_dir "${INSTALL_LIBDIR}/metatypes") + # INSTALL_ARCHDATADIR is not set when QtBuildInternals is not loaded + # (when not doing a Qt build). Default to a hardcoded location for user + # projects (will likely be wrong). + if(INSTALL_ARCHDATADIR) + set(install_dir "${INSTALL_ARCHDATADIR}/metatypes") else() set(install_dir "lib/metatypes") endif()