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.
This commit is contained in:
Martchus 2020-11-07 21:26:57 +01:00
parent 62df4284da
commit deb9b4467f
1 changed files with 12 additions and 3 deletions

View File

@ -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")