summaryrefslogtreecommitdiffstats
path: root/cmake/QtBuild.cmake
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@qt.io>2021-03-23 15:48:56 +1100
committerCraig Scott <craig.scott@qt.io>2021-03-29 18:10:22 +1100
commitaa4a1006cbccbc180c600f9b4dc9e882bb5ed5ca (patch)
tree93a1b56b677e453d52f5bf5ff991fb423ee0b8b7 /cmake/QtBuild.cmake
parent2801c1988742b18557c581a544a70a02f4faefa1 (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 Pick-to: 6.1 Change-Id: I0105523afd95995923bd20fc963d245bbb15d34d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtBuild.cmake')
-rw-r--r--cmake/QtBuild.cmake59
1 files changed, 37 insertions, 22 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 66ef694121..c904743b8a 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -458,28 +458,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
@@ -542,6 +520,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")