diff options
author | Leander Beernaert <leander.beernaert@qt.io> | 2019-10-10 14:21:02 +0200 |
---|---|---|
committer | Leander Beernaert <leander.beernaert@qt.io> | 2019-10-10 13:06:51 +0000 |
commit | b42feb02ceebfcf86caf8c8aa8be3e84b8e431ca (patch) | |
tree | 36e0e5c049f6dee42095d587d0f609ed70597f5d | |
parent | fbf27595984f79787588bf4c59217ae6707313a3 (diff) |
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 <simon.hausmann@qt.io>
-rw-r--r-- | cmake/QtBuild.cmake | 6 | ||||
-rwxr-xr-x | util/cmake/pro2cmake.py | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 5f32e6b195..91613f73f1 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 6e9f53aa3f..211678a886 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: |