aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/tutorials/extending-qml/chapter6-plugins/CMakeLists.txt
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-08-25 16:20:34 +0200
committerCraig Scott <craig.scott@qt.io>2021-08-31 14:51:25 +1000
commit9cbf4d2cc85723dadadadb5fe1ade9719dfeb2a6 (patch)
treeef785f5c4e16027f6707f83378fe677a10a283e1 /examples/qml/tutorials/extending-qml/chapter6-plugins/CMakeLists.txt
parent784af37650a77b30de01776262c1fe6727075615 (diff)
CMake: qmake: Fix chapter6-plugins example to build in more configs
Before this change, I tested the following configurations / scenarios (1) shared Qt + qmake + macOS bundle -> works (2) shared Qt + CMake + macOS bundle -> broken (3) static Qt + qmake + macOS bundle -> broken (4) static Qt + CMake + macOS bundle -> works (2) was broken because the shared qml plugin is not located in the expected location (see below) (3) was broken because qmake needs a lot of error-prone boilerplate to ensure static qml plugin building and linking works. The change fixes the example to build and run successfully in case (2). Tested the following scenarios on macOS with the change shared Qt + qmake + macOS bundle -> works shared Qt + CMake + macOS bundle -> works shared Qt + qmake + no bundle -> works shared Qt + CMake + no bundle -> works static Qt + qmake -> still broken static Qt + CMake -> works To make shared qml plugins be found in a macOS bundle, we need to copy the qmldir and plugin under the bundle's PlugIns subfolder, because the application adds that as the expected qml import path for macOS. This basically mimics what the qmake project does with QMAKE_BUNDLE_DATA. The change also cleans up the CMake projects a bit so they don't link PUBLIC-ly against dependencies, install the plugin under a more sensible location and don't needlessly setup package finding and other boilerplate that's done in the parent project. The change also cleans up the qmake projects to adjust to not pollute the macos bundle dir with static plugin files. Amends 9e1d2a0eb15487f8f2acb4d91b281568897fb4e1 Pick-to: 6.2 Change-Id: I45bb699a67adf598587350a03f778291fad3f850 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'examples/qml/tutorials/extending-qml/chapter6-plugins/CMakeLists.txt')
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/CMakeLists.txt2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter6-plugins/CMakeLists.txt
index cf3d218c57..dc0b20dc21 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/CMakeLists.txt
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/CMakeLists.txt
@@ -25,7 +25,7 @@ set_target_properties(chapter6-plugins PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_link_libraries(chapter6-plugins PUBLIC
+target_link_libraries(chapter6-plugins PRIVATE
Qt::Qml
Qt::Quick
)