From deb9b4467fd12eafa70a3e9ff573a040575a4394 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 7 Nov 2020 21:26:57 +0100 Subject: [PATCH] Look for Svg plugins within the Gui module's directory as well In Qt 5 these plugins were loaded as part of the Svg module (at least with my patches). With Qt 6 (for which I've dropped my patches) we need to include the plugin's config file manually. --- cmake/modules/QtLinkage.cmake | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cmake/modules/QtLinkage.cmake b/cmake/modules/QtLinkage.cmake index 5ef26de..c69f868 100644 --- a/cmake/modules/QtLinkage.cmake +++ b/cmake/modules/QtLinkage.cmake @@ -82,13 +82,22 @@ macro (use_qt_module) # find and use plugins foreach (PLUGIN ${ARGS_PLUGINS}) - if (NOT TARGET "${ARGS_PREFIX}::Q${PLUGIN}Plugin") + set(PLUGIN_TARGET "${ARGS_PREFIX}::Q${PLUGIN}Plugin") + if (NOT TARGET "${PLUGIN_TARGET}") find_package("${ARGS_PREFIX}${ARGS_MODULE}" "${META_QT5_VERSION}" REQUIRED) endif () - if (NOT TARGET "${ARGS_PREFIX}::Q${PLUGIN}Plugin") + if (NOT TARGET "${PLUGIN_TARGET}" AND PLUGIN MATCHES "Svg.*" AND ARGS_MODULE STREQUAL "Svg") + # look for Svg plugins within the Gui module's directory as well + find_package("${ARGS_PREFIX}Gui" "${META_QT5_VERSION}" REQUIRED) + set(PLUGIN_CONFIG "${${ARGS_PREFIX}Gui_DIR}/${ARGS_PREFIX}Q${PLUGIN}PluginConfig.cmake") + if (EXISTS "${PLUGIN_CONFIG}") + include("${PLUGIN_CONFIG}") + endif () + endif () + if (NOT TARGET "${PLUGIN_TARGET}") message(FATAL_ERROR "The ${ARGS_PREFIX}${ARGS_MODULE} package does not provide the target ${ARGS_PREFIX}::Q${PLUGIN}Plugin.") endif () - if ("${ARGS_PREFIX}::Q${PLUGIN}Plugin" IN_LIST "${ARGS_LIBRARIES_VARIABLE}") + if ("${PLUGIN_TARGET}" IN_LIST "${ARGS_LIBRARIES_VARIABLE}") continue() endif () set("${ARGS_LIBRARIES_VARIABLE}" "${${ARGS_LIBRARIES_VARIABLE}};${ARGS_PREFIX}::Q${PLUGIN}Plugin")