qtbase/cmake/QtPublicPluginHelpers_v2.cmake
Alexey Edelev 8977feb647 Introduce a new way of collecting plugin targets
Use the propagated interface property to collect the plugins for the
android deployment. This method allows collecting plugins from the Qt
libraries without using walk-libs approach with all its disadvantages.

The only limitation is the CMake version, since custom transitive
properties support was added in the CMake version 3.30.

For now it's only uses in Android deployment, will be spread wider
in followup commits.

Fixes: QTBUG-129302
Change-Id: I8d5ae7342d57d215021ad02c51dda44f88c9a920
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-11-14 00:56:12 +01:00

31 lines
1.2 KiB
CMake

# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
function(__qt_internal_collect_plugin_targets_from_dependencies_v2 target out_var)
if(CMAKE_VERSION VERSION_LESS 3.30)
__qt_internal_collect_plugin_targets_from_dependencies("${target}" "${out_var}")
set(${out_var} "${${out_var}}" PARENT_SCOPE)
return()
endif()
set("${out_var}" "$<TARGET_PROPERTY:${target},QT_PLUGIN_TARGETS>" PARENT_SCOPE)
endfunction()
function(__qt_internal_collect_plugin_library_files_v2 target plugin_targets out_var)
if(CMAKE_VERSION VERSION_LESS 3.30)
__qt_internal_collect_plugin_library_files("${target}" "${plugin_targets}" "${out_var}")
set(${out_var} "${${out_var}}" PARENT_SCOPE)
return()
endif()
set(plugin_targets "$<GENEX_EVAL:${plugin_targets}>")
# Convert the list of plugin targets to a list of plugin files
set(pre_genex "$$<1:<TARGET_FILE:>")
set(post_genex "$<ANGLE-R>")
set(glue "${post_genex};${pre_genex}")
set("${out_var}"
"$<$<BOOL:${plugin_targets}>:$<GENEX_EVAL:${pre_genex}$<JOIN:${plugin_targets},${glue}>${post_genex}>>"
PARENT_SCOPE
)
endfunction()