diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-03-18 16:57:00 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-03-21 14:05:46 +0000 |
commit | f14544ab925531deae40e18a3eb01e5724f3ed9f (patch) | |
tree | 2a055761e9437fea36b500fa5078f5518831e0c8 | |
parent | 3cb9792777a41f6ab685472fa97708c9d6fb3c23 (diff) |
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)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/assistant/qhelpgenerator/CMakeLists.txt | 31 |
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() |