CMake: Set versioned variables with found modules, plugins, types
Introduce two new directory-scoped variables containing versioned (prefixed with Qt6::) target names of qt modules and qt plugins found as a result of finding Qt packages: - QT_ALL_MODULES_VERSIONED_FOUND_VIA_FIND_PACKAGE - QT_ALL_PLUGINS_VERSIONED_FOUND_VIA_FIND_PACKAGE To be consistent in the naming of the variables going forward, deprecate the old QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE variable in favor of a new QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE. The difference is 'BY' vs 'VIA'. The non-versioned variables are modified not to contain duplicates: - QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE - QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE Also remove duplicates from the variable that collects all found qt plugin types: - QT_ALL_PLUGIN_TYPES_FOUND_VIA_FIND_PACKAGE A follow-up change will collect qml plugin targets. This information can be useful to find out what Qt targets are available in a project, for example to know what plugin targets or types can be linked into another target, or which libraries can be deployed. Pick-to: 6.8 Change-Id: I4f158872f4a8f6ef6008f081270604f75b77ad9d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit f7b8ff71778bde94741402216269c2de2dda32c1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
74c455c8bb
commit
93f52f7980
@ -170,18 +170,28 @@ if (TARGET @QT_CMAKE_EXPORT_NAMESPACE@::@target@)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Plugins.cmake")
|
||||
endif()
|
||||
|
||||
list(APPEND QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE "@target@")
|
||||
if(NOT "@target@" IN_LIST QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE)
|
||||
list(APPEND QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE "@target@")
|
||||
list(APPEND QT_ALL_MODULES_VERSIONED_FOUND_VIA_FIND_PACKAGE
|
||||
"@INSTALL_CMAKE_NAMESPACE@::@target@")
|
||||
endif()
|
||||
|
||||
get_target_property(_qt_module_target_type "@INSTALL_CMAKE_NAMESPACE@::@target@" TYPE)
|
||||
if(NOT _qt_module_target_type STREQUAL "INTERFACE_LIBRARY")
|
||||
get_target_property(_qt_module_plugin_types
|
||||
@INSTALL_CMAKE_NAMESPACE@::@target@ MODULE_PLUGIN_TYPES)
|
||||
if(_qt_module_plugin_types)
|
||||
list(APPEND QT_ALL_PLUGIN_TYPES_FOUND_VIA_FIND_PACKAGE "${_qt_module_plugin_types}")
|
||||
foreach(_qt_module_plugin_type IN LISTS _qt_module_plugin_types)
|
||||
if(NOT "${_qt_module_plugin_type}"
|
||||
IN_LIST QT_ALL_PLUGIN_TYPES_FOUND_VIA_FIND_PACKAGE)
|
||||
list(APPEND QT_ALL_PLUGIN_TYPES_FOUND_VIA_FIND_PACKAGE
|
||||
"${_qt_module_plugin_type}")
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_qt_module_plugin_type)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# Load Module's BuildInternals should any exist
|
||||
if (@INSTALL_CMAKE_NAMESPACE@BuildInternals_DIR AND
|
||||
EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@BuildInternals.cmake")
|
||||
|
@ -581,10 +581,34 @@ macro(__qt_internal_include_plugin_packages target)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
list(APPEND "QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_${__plugin_type}" "${plugin_target}")
|
||||
set(plugin_target_versioned "${QT_CMAKE_EXPORT_NAMESPACE}::${plugin_target}")
|
||||
|
||||
if(NOT "${plugin_target}"
|
||||
IN_LIST QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE)
|
||||
|
||||
# Old compatibility name.
|
||||
# TODO: Remove once all usages are ported.
|
||||
list(APPEND QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE "${plugin_target}")
|
||||
|
||||
# New name consistent with other such variables.
|
||||
list(APPEND QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE "${plugin_target}")
|
||||
list(APPEND QT_ALL_PLUGINS_VERSIONED_FOUND_VIA_FIND_PACKAGE
|
||||
"${plugin_target_versioned}")
|
||||
endif()
|
||||
|
||||
if(NOT "${plugin_target}" IN_LIST QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE_${__plugin_type})
|
||||
# Old compatibility name.
|
||||
# TODO: Remove once all usages are ported.
|
||||
list(APPEND QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_${__plugin_type} "${plugin_target}")
|
||||
|
||||
# New name consistent with other such variables.
|
||||
list(APPEND QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE_${__plugin_type} "${plugin_target}")
|
||||
list(APPEND
|
||||
QT_ALL_PLUGINS_VERSIONED_FOUND_VIA_FIND_PACKAGE_${__plugin_type}
|
||||
"${plugin_target_versioned}")
|
||||
endif()
|
||||
|
||||
# Auto-linkage should be set up only for static plugins.
|
||||
set(plugin_target_versioned "${QT_CMAKE_EXPORT_NAMESPACE}::${plugin_target}")
|
||||
get_target_property(type "${plugin_target_versioned}" TYPE)
|
||||
if(type STREQUAL STATIC_LIBRARY)
|
||||
__qt_internal_add_static_plugin_linkage(
|
||||
|
Loading…
x
Reference in New Issue
Block a user