aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/animation
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-30 22:24:01 +0200
commit54774a5203ef45fe5b47b09f5ee1d57f07c9ecef (patch)
treea4cf12b2190e870cc43112f94dcb9a2469109010 /examples/quick/animation
parent61b22013b192da2cfc3a061f2f5ffa65682f368b (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 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> (cherry picked from commit edc4357ae4893dd952ce1c07b180b4b334047606) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'examples/quick/animation')
-rw-r--r--examples/quick/animation/CMakeLists.txt2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/quick/animation/CMakeLists.txt b/examples/quick/animation/CMakeLists.txt
index 2d565c24f9..29c6e184e0 100644
--- a/examples/quick/animation/CMakeLists.txt
+++ b/examples/quick/animation/CMakeLists.txt
@@ -34,8 +34,8 @@ target_link_libraries(animationexample PUBLIC
Qt::Gui
Qt::Qml
Qt::Quick
- animation_shared
)
+add_dependencies(animationexample animation_shared)
qt_add_qml_module(animationexample
URI animation