From 02a5b34c07a10e7fd5ffd785834e5da5a9cf9739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sun, 7 Aug 2022 15:09:34 +0200 Subject: [PATCH] cmake: Defer generating plugin .pri file until finalizer Allows adding additional properties to the target after the initial call to qt_internal_add_plugin. Change-Id: I7998c906e53699ec41b44b51aabbe480ae698b21 Reviewed-by: Alexandru Croitor --- cmake/QtPluginHelpers.cmake | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/cmake/QtPluginHelpers.cmake b/cmake/QtPluginHelpers.cmake index 03d264b453e..dfcdedb370e 100644 --- a/cmake/QtPluginHelpers.cmake +++ b/cmake/QtPluginHelpers.cmake @@ -363,11 +363,6 @@ function(qt_internal_add_plugin target) get_target_property(target_type "${target}" TYPE) if(target_type STREQUAL STATIC_LIBRARY) - # There's no point in generating pri files for qml plugins. We didn't do it in Qt5 times. - if(NOT plugin_type_escaped STREQUAL "qml_plugin") - qt_generate_plugin_pri_file("${target}" pri_file) - endif() - if(qt_module_target) qt_internal_link_internal_platform_for_object_library("${plugin_init_target}") endif() @@ -417,9 +412,6 @@ function(qt_internal_add_plugin target) DESTINATION "${config_install_dir}" COMPONENT Devel ) - if(pri_file) - qt_install(FILES "${pri_file}" DESTINATION "${INSTALL_MKSPECSDIR}/modules") - endif() # Make the export name of plugins be consistent with modules, so that # qt_add_resource adds its additional targets to the same export set in a static Qt build. @@ -468,12 +460,22 @@ function(qt_finalize_plugin target) _qt_internal_generate_win32_rc_file("${target}") endif() - # Generate .prl files for static plugins. + # Generate .prl and .pri files for static plugins. get_target_property(target_type "${target}" TYPE) if(target_type STREQUAL STATIC_LIBRARY) if(arg_INSTALL_PATH) qt_generate_prl_file(${target} "${arg_INSTALL_PATH}") endif() + + # There's no point in generating pri files for qml plugins. + # We didn't do it in Qt5 times. + get_target_property(plugin_type "${target}" QT_PLUGIN_TYPE) + if(NOT plugin_type STREQUAL "qml_plugin") + qt_generate_plugin_pri_file("${target}" pri_file) + if(pri_file) + qt_install(FILES "${pri_file}" DESTINATION "${INSTALL_MKSPECSDIR}/modules") + endif() + endif() endif() endfunction()