From b42feb02ceebfcf86caf8c8aa8be3e84b8e431ca Mon Sep 17 00:00:00 2001 From: Leander Beernaert Date: Thu, 10 Oct 2019 14:21:02 +0200 Subject: [PATCH] Add install directory for plugins without type When we run into a plugin that does not have a type and is not a qml plugin, we try to see if we can find the target installation path and provide INSTALL_DIRECTORY AND ARCHIVE_INSTALL_DIRECTORY to the add_qt_plugin call. We run into this frequently with the unit tests. This patch also changes add_qt_plugin() to use the value provided in INSTALL_DIRECTORY for ARCHIVE_INSTALL_DIRECTORY if no value is provided for the latter. Change-Id: I61278904a4d2d72308079cd362bd085b4e2f540c Reviewed-by: Simon Hausmann --- cmake/QtBuild.cmake | 6 +++--- util/cmake/pro2cmake.py | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 5f32e6b1953..91613f73f1d 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -1783,9 +1783,9 @@ function(add_qt_plugin target) "${output_directory_default}" output_directory) qt_internal_check_directory_or_type(INSTALL_DIRECTORY "${arg_INSTALL_DIRECTORY}" "${arg_TYPE}" "${install_directory_default}" install_directory) - qt_internal_check_directory_or_type(ARCHIVE_INSTALL_DIRECTORY - "${arg_ARCHIVE_INSTALL_DIRECTORY}" "${arg_TYPE}" - "${archive_install_directory_default}" archive_install_directory) + if (NOT arg_ARCHIVE_INSTALL_DIRECTORY AND arg_INSTALL_DIRECTORY) + set(arg_ARCHIVE_INSTALL_DIRECTORY "${arg_INSTALL_DIRECTORY}") + endif() if(arg_STATIC OR NOT BUILD_SHARED_LIBS) add_library("${target}" STATIC) diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 6e9f53aa3f3..211678a8863 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -3106,6 +3106,11 @@ def write_plugin(cm_fh, scope, *, indent: int = 0) -> str: elif is_qml_plugin: plugin_function_name = "add_qml_module" qmldir = write_qml_plugin(cm_fh, plugin_name, scope, indent=indent, extra_lines=extra) + else: + target_path = scope.expandString('target.path') + target_path = replace_path_constants(target_path, scope) + if target_path: + extra.append(f'INSTALL_DIRECTORY "{target_path}"') plugin_class_name = scope.get_string("PLUGIN_CLASS_NAME") if plugin_class_name: