summaryrefslogtreecommitdiff
path: root/src/assistant
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-03-18 16:57:00 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-03-21 14:15:49 +0100
commit0412da38b3d00ca4a192b0d262ad5b0e35b51503 (patch)
tree1dc33d34b8859c2cb4c03d0e8395e5e38a8cd5d7 /src/assistant
parentf2c8619270bf1ad7e743111d4e8200dc4105b58f (diff)
downloadqttools-0412da38b3d00ca4a192b0d262ad5b0e35b51503.tar.gz
CMake: Fix qhelpgenerator to run in static builds
Explicitly link to the minimal qpa plugin, because qhelpgenerator expects it to be available. Unfortunately we have two implement it in two different ways, depending on whether it's a top-level build or not. In a per-repo build, we can rely on using qt_import_plugins. In a top-level build we have to manually create a source file to initialize the plugin and link to the plugin manually. Pick-to: 6.2 6.3 Fixes: QTBUG-93238 Change-Id: If9cac4a60d5a6632f2b33c6748d62ca462b1e022 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Diffstat (limited to 'src/assistant')
-rw-r--r--src/assistant/qhelpgenerator/CMakeLists.txt31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/assistant/qhelpgenerator/CMakeLists.txt b/src/assistant/qhelpgenerator/CMakeLists.txt
index 3f79a87f4..cdafe99df 100644
--- a/src/assistant/qhelpgenerator/CMakeLists.txt
+++ b/src/assistant/qhelpgenerator/CMakeLists.txt
@@ -23,7 +23,30 @@ qt_internal_add_tool(${target_name}
)
qt_internal_return_unless_building_tools()
-#### Keys ignored in scope 1:.:.:qhelpgenerator.pro:<TRUE>:
-# QMAKE_TARGET_DESCRIPTION = "Qt Compressed Help File Generator"
-# QTPLUGIN.platforms = "qminimal"
-# QTPLUGIN.sqldrivers = "qsqlite"
+if(NOT QT_BUILD_SHARED_LIBS)
+ if(QT_SUPERBUILD)
+ # In a top-level build, qt_import_plugins() is a no-op because
+ # __qt_internal_add_static_plugins_once() is not called.
+ # So we need to initialize and link the plugin manually.
+ set(out_file_path "${CMAKE_CURRENT_BINARY_DIR}/${target_name}_plugin_imports_custom.cpp")
+
+ file(GENERATE OUTPUT "${out_file_path}" CONTENT
+"// This file is auto-generated. Do not edit.
+#include <QtPlugin>
+
+Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin)
+")
+
+ # CMake versions earlier than 3.18.0 can't find the generated file for some reason,
+ # failing at generation phase.
+ # Explicitly marking the file as GENERATED fixes the issue.
+ set_source_files_properties("${out_file_path}" PROPERTIES GENERATED TRUE)
+
+ target_sources(${target_name} PRIVATE "${out_file_path}")
+ target_link_libraries(${target_name} PRIVATE Qt::QMinimalIntegrationPlugin)
+ else()
+ qt_import_plugins(${target_name}
+ INCLUDE Qt::QMinimalIntegrationPlugin
+ )
+ endif()
+endif()