CMake: Collect all known qml plugin targets into a directory variable
Just like we do with qt plugins, collect all found qml plugin targets into two new directory scoped variables: - QT_ALL_QML_PLUGINS_FOUND_VIA_FIND_PACKAGE - QT_ALL_QML_PLUGINS_VERSIONED_FOUND_VIA_FIND_PACKAGE The plugin target names are derived from the Config.cmake file names, based on the existing assumption that qt_internal_add_plugin always uses the target name when generating the Config.cmake file. Pick-to: 6.8 6.9 Change-Id: I78c76488e133fb3c0374cbc149425726077f6c31 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
47006aca44
commit
bf83fffd13
@ -518,6 +518,20 @@ function(__qt_internal_add_interface_plugin_target plugin_module_target plugin_t
|
||||
APPEND PROPERTY INTERFACE_QT_PLUGIN_TARGETS ${plugin_target_name_wrapped})
|
||||
endfunction()
|
||||
|
||||
# TODO: Figure out how to do this more reliably, instead of parsing the file name to get
|
||||
# the target name.
|
||||
function(__qt_internal_get_target_name_from_plugin_config_file_name
|
||||
config_file_path
|
||||
package_prefix_regex
|
||||
out_var)
|
||||
string(REGEX REPLACE
|
||||
"^.*/${QT_CMAKE_EXPORT_NAMESPACE}(${package_prefix_regex})Config.cmake$"
|
||||
"\\1"
|
||||
target "${config_file_path}")
|
||||
|
||||
set(${out_var} "${target}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Include CMake plugin packages that belong to the Qt module ${target} and initialize automatic
|
||||
# linkage of the plugins in static builds.
|
||||
# The variables inside the macro have to be named unique to the module because an included Plugin
|
||||
@ -546,11 +560,14 @@ macro(__qt_internal_include_plugin_packages target)
|
||||
file(GLOB __qt_${target}_plugin_config_files
|
||||
"${CMAKE_CURRENT_LIST_DIR}/${QT_CMAKE_EXPORT_NAMESPACE}*PluginConfig.cmake")
|
||||
foreach(__qt_${target}_plugin_config_file ${__qt_${target}_plugin_config_files})
|
||||
string(REGEX REPLACE
|
||||
"^.*/${QT_CMAKE_EXPORT_NAMESPACE}(.*Plugin)Config.cmake$"
|
||||
"\\1"
|
||||
__qt_${target}_qt_plugin "${__qt_${target}_plugin_config_file}")
|
||||
include("${__qt_${target}_plugin_config_file}")
|
||||
|
||||
__qt_internal_get_target_name_from_plugin_config_file_name(
|
||||
"${__qt_${target}_plugin_config_file}"
|
||||
"(.*Plugin)"
|
||||
__qt_${target}_qt_plugin
|
||||
)
|
||||
|
||||
if(TARGET "${QT_CMAKE_EXPORT_NAMESPACE}::${__qt_${target}_qt_plugin}")
|
||||
list(APPEND __qt_${target}_plugins ${__qt_${target}_qt_plugin})
|
||||
__qt_internal_add_interface_plugin_target(${__qt_${target}_plugin_module_target}
|
||||
@ -677,6 +694,24 @@ macro(__qt_internal_include_qml_plugin_packages)
|
||||
foreach(__qt_qml_plugin_config_file ${__qt_qml_plugins_config_file_list})
|
||||
include(${__qt_qml_plugin_config_file})
|
||||
|
||||
__qt_internal_get_target_name_from_plugin_config_file_name(
|
||||
"${__qt_qml_plugin_config_file}"
|
||||
"(.*)"
|
||||
__qt_qml_plugin_target
|
||||
)
|
||||
set(__qt_qml_plugin_target_versioned
|
||||
"${QT_CMAKE_EXPORT_NAMESPACE}::${__qt_qml_plugin_target}")
|
||||
|
||||
if(TARGET "${__qt_qml_plugin_target_versioned}"
|
||||
AND NOT "${__qt_qml_plugin_target}"
|
||||
IN_LIST QT_ALL_QML_PLUGINS_FOUND_VIA_FIND_PACKAGE)
|
||||
list(APPEND QT_ALL_QML_PLUGINS_FOUND_VIA_FIND_PACKAGE "${__qt_qml_plugin_target}")
|
||||
list(APPEND QT_ALL_QML_PLUGINS_VERSIONED_FOUND_VIA_FIND_PACKAGE
|
||||
"${__qt_qml_plugin_target_versioned}")
|
||||
endif()
|
||||
unset(__qt_qml_plugin_target)
|
||||
unset(__qt_qml_plugin_target_versioned)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE)
|
||||
string(APPEND ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
|
||||
"\nThe message was set in ${__qt_qml_plugin_config_file} ")
|
||||
|
Loading…
x
Reference in New Issue
Block a user