summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-08-04 16:18:44 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2021-08-06 21:08:21 +0200
commitb2f00dfb46af633b00946cb1ebfe963964f803ca (patch)
tree0b52bda2d0e77744c7969c06ce5882c8d7c9cb2d /cmake
parenteb4fb9fa32797d48d4779464483230ad92f349a6 (diff)
CMake: Rename qt6_add_plugin TYPE option to PLUGIN_TYPE
The intention is to remove TYPE as a keyword completely before 6.2.0 release, but in case if that's not possible due to the large amount of repositories and examples, just print a deprecation warning for now and handle both TYPE and PLUGIN_TYPE. Task-number: QTBUG-95170 Pick-to: 6.2 Change-Id: If0c18345483b9254b0fc21120229fcc2a2fbfbf5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtPluginHelpers.cmake26
-rw-r--r--cmake/QtTargetHelpers.cmake3
2 files changed, 20 insertions, 9 deletions
diff --git a/cmake/QtPluginHelpers.cmake b/cmake/QtPluginHelpers.cmake
index 4ec7ef6009..eae24faa9c 100644
--- a/cmake/QtPluginHelpers.cmake
+++ b/cmake/QtPluginHelpers.cmake
@@ -20,7 +20,7 @@ macro(qt_internal_get_internal_add_plugin_keywords option_args single_args multi
endmacro()
# This is the main entry point for defining Qt plugins.
-# A CMake target is created with the given target. The TYPE parameter is needed to place the
+# A CMake target is created with the given target. The PLUGIN_TYPE parameter is needed to place the
# plugin into the correct plugins/ sub-directory.
function(qt_internal_add_plugin target)
qt_internal_set_qt_known_plugins("${QT_KNOWN_PLUGINS}" "${target}")
@@ -78,15 +78,25 @@ function(qt_internal_add_plugin target)
qt6_add_plugin(${target} ${plugin_args})
qt_internal_mark_as_internal_library(${target})
- qt_get_sanitized_plugin_type("${arg_TYPE}" plugin_type_escaped)
+ set(plugin_type "")
+ # TODO: Transitional: Remove the TYPE option handling after all repos have been converted to use
+ # PLUGIN_TYPE.
+ if(arg_TYPE)
+ set(plugin_type "${arg_TYPE}")
+ elseif(arg_PLUGIN_TYPE)
+ set(plugin_type "${arg_PLUGIN_TYPE}")
+ endif()
+
+ qt_get_sanitized_plugin_type("${plugin_type}" plugin_type_escaped)
- set(output_directory_default "${QT_BUILD_DIR}/${INSTALL_PLUGINSDIR}/${arg_TYPE}")
- set(install_directory_default "${INSTALL_PLUGINSDIR}/${arg_TYPE}")
+ set(output_directory_default "${QT_BUILD_DIR}/${INSTALL_PLUGINSDIR}/${plugin_type}")
+ set(install_directory_default "${INSTALL_PLUGINSDIR}/${plugin_type}")
- qt_internal_check_directory_or_type(OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}" "${arg_TYPE}"
+ qt_internal_check_directory_or_type(OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}" "${plugin_type}"
"${output_directory_default}" output_directory)
if (NOT arg_SKIP_INSTALL)
- qt_internal_check_directory_or_type(INSTALL_DIRECTORY "${arg_INSTALL_DIRECTORY}" "${arg_TYPE}"
+ qt_internal_check_directory_or_type(INSTALL_DIRECTORY "${arg_INSTALL_DIRECTORY}"
+ "${plugin_type}"
"${install_directory_default}" install_directory)
set(archive_install_directory ${arg_ARCHIVE_INSTALL_DIRECTORY})
if (NOT archive_install_directory AND install_directory)
@@ -126,7 +136,7 @@ function(qt_internal_add_plugin target)
ARCHIVE_OUTPUT_DIRECTORY "${output_directory}"
QT_PLUGIN_TYPE "${plugin_type_escaped}"
# Save the non-sanitized plugin type values for qmake consumption via .pri files.
- QT_QMAKE_PLUGIN_TYPE "${arg_TYPE}"
+ QT_QMAKE_PLUGIN_TYPE "${plugin_type}"
)
qt_handle_multi_config_output_dirs("${target}")
@@ -254,7 +264,7 @@ function(qt_internal_add_plugin target)
if(TARGET qt_plugins)
add_dependencies(qt_plugins "${target}")
endif()
- if(arg_TYPE STREQUAL "platforms")
+ if(plugin_type STREQUAL "platforms")
if(TARGET qpa_plugins)
add_dependencies(qpa_plugins "${target}")
endif()
diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake
index 911f25a1ae..baee28ee1e 100644
--- a/cmake/QtTargetHelpers.cmake
+++ b/cmake/QtTargetHelpers.cmake
@@ -248,7 +248,8 @@ endfunction()
function(qt_internal_check_directory_or_type name dir type default result_var)
if ("x${dir}" STREQUAL x)
if("x${type}" STREQUAL x)
- message(FATAL_ERROR "qt_internal_add_plugin called without setting either TYPE or ${name}.")
+ message(FATAL_ERROR
+ "qt_internal_add_plugin called without setting either PLUGIN_TYPE or ${name}.")
endif()
set(${result_var} "${default}" PARENT_SCOPE)
else()