diff options
author | Craig Scott <craig.scott@qt.io> | 2021-03-23 15:48:56 +1100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-03-29 10:56:07 +0000 |
commit | b296202831e8f1bb3a3fda1159289199a7097a71 (patch) | |
tree | 3e537398a6bd322a5a69532dd725d128f9dbd103 /cmake/QtBuild.cmake | |
parent | 4e624996a777e9a509338ae25e8a30944fa3963e (diff) |
Refactor qt_internal_add_plugin() and qt6_add_plugin()
Remove code duplication by calling qt6_add_plugin() from
qt_internal_add_plugin().
Separate out the public and internal arguments for the
variables defined in QtBuild.cmake for these functions.
Provide them via commands instead for greater robustness.
This separation allows other Qt repos to access the appropriate
set of keywords where they define commands that forward
on to *_add_plugin() in their implementations. Retain
the old variables for now to simplify the integration
steps for updating other repos. The old variables can
be removed once there are no more references left to
them in any repo.
Task-number: QTBUG-88763
Change-Id: I0105523afd95995923bd20fc963d245bbb15d34d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit aa4a1006cbccbc180c600f9b4dc9e882bb5ed5ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake/QtBuild.cmake')
-rw-r--r-- | cmake/QtBuild.cmake | 59 |
1 files changed, 37 insertions, 22 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 7df7abf35b..8547ff09d1 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -448,28 +448,6 @@ set(__default_target_info_args TARGET_COPYRIGHT ) -# Collection of qt_add_plugin arguments so they can be shared across different -# plugin type wrappers -set(__qt_add_plugin_optional_args - STATIC - EXCEPTIONS - ALLOW_UNDEFINED_SYMBOLS -) -set(__qt_add_plugin_single_args - TYPE - CLASS_NAME - OUTPUT_DIRECTORY - INSTALL_DIRECTORY - ARCHIVE_INSTALL_DIRECTORY - OUTPUT_NAME - ${__default_target_info_args} -) -set(__qt_add_plugin_multi_args - ${__default_private_args} - ${__default_public_args} - DEFAULT_IF -) - # Collection of arguments so they can be shared across qt_internal_add_executable # and qt_internal_add_test_helper. set(__qt_internal_add_executable_optional_args @@ -533,6 +511,43 @@ if(ANDROID) include(QtAndroidHelpers) endif() +# TODO: This block provides support for old variables. It should be removed once +# we remove all references to these variables in other Qt module repos. +# Prefer to use the provided commands to retrieve the relevant things instead. +# We won't have the queried command when we get here for qtbase (it is +# provided by the Core module), but we will for all other repos (which +# is all we need). +if(COMMAND _qt_internal_get_add_plugin_keywords) + _qt_internal_get_add_plugin_keywords( + __qt_public_add_plugin_option_args + __qt_public_add_plugin_single_args + __qt_public_add_plugin_multi_args + ) + qt_internal_get_internal_add_plugin_keywords( + __qt_internal_add_plugin_option_args + __qt_internal_add_plugin_single_args + __qt_internal_add_plugin_multi_args + ) + set(__qt_add_plugin_optional_args + ${__qt_public_add_plugin_option_args} + ${__qt_internal_add_plugin_option_args} + ) + set(__qt_add_plugin_single_args + ${__qt_public_add_plugin_single_args} + ${__qt_internal_add_plugin_single_args} + ) + set(__qt_add_plugin_multi_args + ${__qt_public_add_plugin_multi_args} + ${__qt_internal_add_plugin_multi_args} + ) + unset(__qt_public_add_plugin_option_args) + unset(__qt_public_add_plugin_single_args) + unset(__qt_public_add_plugin_multi_args) + unset(__qt_internal_add_plugin_option_args) + unset(__qt_internal_add_plugin_single_args) + unset(__qt_internal_add_plugin_multi_args) +endif() + # This sets up the poor man's scope finalizer mechanism. # For newer CMake versions, we use cmake_language(DEFER CALL) instead. if(CMAKE_VERSION VERSION_LESS "3.19.0") |