aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/shapes/CMakeLists.txt
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-09-23 16:55:11 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2021-09-29 16:14:44 +0200
commitedc4357ae4893dd952ce1c07b180b4b334047606 (patch)
tree8bbcacc28972b851161e005b40555ed28bba0ce1 /examples/quick/shapes/CMakeLists.txt
parent2a04bfaf3a2054222cc8a508ecd11727f2b2269b (diff)
CMake: Fix examples that use 'shared' project when using a static Qt
When using a static Qt, linking of examples that use the 'shared' Qml module would fail with the following error Undefined symbols for architecture x86_64: "qt_static_plugin_sharedPlugin()", referenced from: StaticsharedPluginPluginInstance::StaticsharedPluginPluginInstance() in window_shared_init.cpp.o This happened because the 'shared' project pre-created its plugin target with qt_add_library instead of qt_add_plugin. qt_add_plugin passes an additional QT_STATICPLUGIN compile definition when compiling the moc'ed file to ensure that the QT_MOC_EXPORT_PLUGIN macro creates a qt_plugin_instance_PLUGIN_NAME symbol. Unfortunately we can't use qt_add_plugin for shared Qt builds, because some of the projects link directly against the plugin target and it's not possible to link against a MODULE_LIBRARY target which qt_add_plugin creates in shared Qt build. We could try to conditionally switch between using qt_add_library for a shared Qt build and qt_add_plugin for a static Qt build, but that further complicates the build system code because it requires specifying a class name and plugin type explicitly. Remove the direct linkage against the libraries in the examples and instead rely on plugin loading. This simplifies the logic of not having to pre-create a target. Amends 7b6eea37aeea55cdf1bcb1fd9c3091d6753f95e8 Pick-to: 6.2 Fixes: QTBUG-96805 Change-Id: I5b2f3992ccda29b59f1e99748005381c73daca69 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'examples/quick/shapes/CMakeLists.txt')
-rw-r--r--examples/quick/shapes/CMakeLists.txt2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/quick/shapes/CMakeLists.txt b/examples/quick/shapes/CMakeLists.txt
index ce83fd32cc..04d00776e6 100644
--- a/examples/quick/shapes/CMakeLists.txt
+++ b/examples/quick/shapes/CMakeLists.txt
@@ -34,8 +34,8 @@ target_link_libraries(shapesexample PUBLIC
Qt::Gui
Qt::Qml
Qt::Quick
- shapes_shared
)
+add_dependencies(shapesexample delegatechooser_shared)
qt_add_qml_module(shapesexample
URI shapes