cmake-qml-plugin-example
cmake-qml-plugin-example copied to clipboard
Install missing
Unfortunately, this example is missing the install step. QML plugins / modules / extensions (whatever you may call it) should be installed in QT_INSTALL_QML
. Please take a look at the QMake equivalent generated by Qt Creator.
Something along the lines of
set(URI QuickContainers)
string(REPLACE "." "/" TARGETPATH ${URI})
execute_process(COMMAND qmake -query QT_INSTALL_QML OUTPUT_VARIABLE QT_INSTALL_QML_RAW)
string(REPLACE "\n" "" QT_INSTALL_QML ${QT_INSTALL_QML_RAW})
set(DESTDIR "${QT_INSTALL_QML}/${TARGETPATH}")
install(TARGETS QuickContainers DESTINATION ${DESTDIR})
should do the trick.
Note that querying qmake
isn't really nice, but seems to be the only option at the moment.
Thank you, this was a great help.
I'd just like to add:
The URI
has to be the name of the module and the TARGETS
has to be the plugin specified in the qmldir.
In the sample they are both QuickContainers but in other cases they may vary.
Also, this is missing the step to install the qmldir file:
install(FILES ${CMAKE_CURRENT_LIST_DIR}/qmldir DESTINATION ${DESTDIR})