CMake: Fix installation location of plugins in static builds of Qt

For static builds of Qt we installed the plugins into the lib
directory. However, they are expected in the plugins directory tree.

This happens, because we pass a value of an uninitialized variable to
ARCHIVE DESTINATION in the qt_install call in qt_internal_add_plugin,
and CMake defaults to "lib".

This flaw was introduced in b42feb02cee with the following intent:
"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."

The patch changed the value of arg_ARCHIVE_INSTALL_DIRECTORY but
missed to set the variable archive_install_directory, which is
actually used in the qt_install call.

We now directly set archive_install_directory and remove the unused
archive_install_directory_default variable.

Task-number: QTBUG-84781
Change-Id: Ifd0475d8452272e8765bf42fd912a45cfa3dbbd1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2020-06-10 14:24:53 +02:00
parent 6d323c0b22
commit a7162704c8

View File

@ -3160,13 +3160,11 @@ function(qt_internal_add_plugin target)
set(output_directory_default "${QT_BUILD_DIR}/${INSTALL_PLUGINSDIR}/${arg_TYPE}")
set(install_directory_default "${INSTALL_PLUGINSDIR}/${arg_TYPE}")
set(archive_install_directory_default "${INSTALL_LIBDIR}/${arg_TYPE}")
if (arg_QML_TARGET_PATH)
set(target_path "${arg_QML_TARGET_PATH}")
set(output_directory_default "${QT_BUILD_DIR}/${INSTALL_QMLDIR}/${target_path}")
set(install_directory_default "${INSTALL_QMLDIR}/${target_path}")
set(archive_install_directory_default "${INSTALL_QMLDIR}/${target_path}")
endif()
# Derive the class name from the target name if it's not explicitly specified.
@ -3185,8 +3183,9 @@ function(qt_internal_add_plugin target)
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}")
set(archive_install_directory ${arg_ARCHIVE_INSTALL_DIRECTORY})
if (NOT archive_install_directory AND install_directory)
set(archive_install_directory "${install_directory}")
endif()
endif()