Add SKIP_INSTALL to add_qt_plugin()

Provide a SKIP_INSTALL argument to add_qt_plugin for test cases with
plugins lacking install information.

Change-Id: Iddb3843fab1790d69d64686530a46057a2ff0477
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Leander Beernaert 2019-10-10 17:02:59 +02:00 committed by Alexandru Croitor
parent fd431fadc1
commit 1dd82a8843
2 changed files with 52 additions and 46 deletions

View File

@ -1758,7 +1758,7 @@ function(add_qt_plugin target)
qt_internal_set_qt_known_plugins("${QT_KNOWN_PLUGINS}" "${target}")
qt_parse_all_arguments(arg "add_qt_plugin"
"${__add_qt_plugin_optional_args}"
"${__add_qt_plugin_optional_args};SKIP_INSTALL"
"${__add_qt_plugin_single_args}"
"${__add_qt_plugin_multi_args}"
"${ARGN}"
@ -1781,11 +1781,13 @@ function(add_qt_plugin target)
qt_internal_check_directory_or_type(OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}" "${arg_TYPE}"
"${output_directory_default}" output_directory)
if (NOT arg_SKIP_INSTALL)
qt_internal_check_directory_or_type(INSTALL_DIRECTORY "${arg_INSTALL_DIRECTORY}" "${arg_TYPE}"
"${install_directory_default}" install_directory)
if (NOT arg_ARCHIVE_INSTALL_DIRECTORY AND arg_INSTALL_DIRECTORY)
set(arg_ARCHIVE_INSTALL_DIRECTORY "${arg_INSTALL_DIRECTORY}")
endif()
endif()
if(arg_STATIC OR NOT BUILD_SHARED_LIBS)
add_library("${target}" STATIC)
@ -1897,6 +1899,7 @@ function(add_qt_plugin target)
qt_register_target_dependencies("${target}" "${arg_PUBLIC_LIBRARIES}" "${qt_libs_private}")
if (NOT arg_SKIP_INSTALL)
# Handle creation of cmake files for consumers of find_package().
# If we are part of a Qt module, the plugin cmake files are installed as part of that module.
if(qt_module)
@ -1939,6 +1942,7 @@ function(add_qt_plugin target)
NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE}::
DESTINATION "${config_install_dir}"
)
endif()
# Store the plug-in type in the target property
set_property(TARGET "${target}" PROPERTY QT_PLUGIN_TYPE "${arg_TYPE}")

View File

@ -2828,6 +2828,8 @@ def write_plugin(cm_fh, scope, *, indent: int = 0) -> str:
target_path = replace_path_constants(target_path, scope)
if target_path:
extra.append(f'INSTALL_DIRECTORY "{target_path}"')
else:
extra.append('SKIP_INSTALL')
plugin_class_name = scope.get_string("PLUGIN_CLASS_NAME")
if plugin_class_name: