Qt Quick Cmake

/ Comments off
  • Status:Closed
  • Resolution: Duplicate
  • Fix Version/s: None
  • Labels:

When building qt dev with cmake and the -static configure flag, it does not automatically import the Qt Quick plugins in use.

This works (somewhat) with qmake, but with cmake it seems to only generate Q_IMPORT_PLUGIN for other plugins, but not for the Qt Quick imports. This causes any Qt Quick application to fail launching.


QTBUG-86669Investigate automatic calling of qt6_import_qml_plugins for examples using a static Qt build

  • Closed
is related to

The Qt 4 libraries are found by the FindQt4 find-module shipped with CMake, whereas the Qt 5 libraries are found using 'Config-file Packages' shipped with Qt 5. See cmake-packages(7) for more information about CMake packages, and see the Qt cmake manual for your Qt version. Qt 4 and Qt 5 may be used together in the same CMake buildsystem. Deprecated Commands ¶. These commands are deprecated and are only made available to maintain backward compatibility. The documentation of each command states the CMake version in which it was deprecated.

QTBUG-87453Examples not compiling due 'CMake Error at ./lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:134 (message)'

  • Closed

Qt Quick Test Cmake

relates to

QTBUG-86949REG: Qt Quick Controls examples fail to run in static build

  • Closed

QTBUG-86950REG: 'import QtQuick.Window' does not work with static build

  • Closed

Gerrit Reviews

No reviews matched the request. Check your Options in the drop-down menu of this sections header.
Qt Build System Team
Eskil Abrahamsen Blomfeldt
0Vote for this issue
3Start watching this issue
Hide There is 1 closed Gerrit change Controls
    Make text example work in static CMake builds
    Gerrit Review:

If you are building your application using the CMake build tool, then you can easily use the QtQuick compiler as well. The integration provided works similar to the qmake integration:

  • Convert your application to use the Qt Resource System for loading your .qml , .js files and qmldir files.
  • Call find_package with Qt5QuickCompiler
  • Replace the use of qt5_add_resources with qtquick_compiler_add_resources if you want to build with support for the Qt Quick Compiler. The integration will ignore any .qrc files that do not contain any files relevant for the compiler.

The following example CMakeLists.txt shows the conversion from a project with regular resources to one that enables the use of the Qt Quick Compiler.

Before the conversion:

After the conversion to use the Qt Quick Compiler:

Cmake Qt Plugin

© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Docker-machine engine-install-url. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.