From a7162704c8f17a2c946e12a8137cb949bb9aaa5a Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 10 Jun 2020 14:24:53 +0200 Subject: [PATCH] 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 --- cmake/QtBuild.cmake | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 0a537ab4fa1..e42c57c6f1a 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -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()