summaryrefslogtreecommitdiff
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-25 18:45:00 +0100
commit6bb4af743708d390fcab5626c01ac79c2a11edb9 (patch)
tree6e7515e0fb7e2d652d8cb998db7fcebb184cd7a4
parentf3a3f0a4eba6c4f86b437e3b2ebfef586fe01dcd (diff)
downloadqttools-6bb4af743708d390fcab5626c01ac79c2a11edb9.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. 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> (cherry picked from commit 0412da38b3d00ca4a192b0d262ad5b0e35b51503)
-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 4e35efa43..2371c7b23 100644
--- a/src/assistant/qhelpgenerator/CMakeLists.txt
+++ b/src/assistant/qhelpgenerator/CMakeLists.txt
@@ -22,7 +22,30 @@ qt_internal_add_tool(${target_name}
Qt::Network
)
-#### 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 AND QT_WILL_BUILD_TOOLS)
+ 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()