Search code examples
linuxqtcmakeqt-quickqt6

Could NOT find Qt6Quick (missing: Qt6Quick_DIR)


The following code works:

find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

But this doesn't work:

find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Quick)

It results in an error:

-- Could NOT find Qt6Quick (missing: Qt6Quick_DIR)
CMake Error at CMakeLists.txt:10 (find_package):
  Found package configuration file:

    /usr/lib/x86_64-linux-gnu/cmake/Qt6/Qt6Config.cmake

  but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
  FOUND.  Reason given by package:

  Failed to find Qt component "Quick".

  Expected Config file at
  "/usr/lib/x86_64-linux-gnu/cmake/Qt6Quick/Qt6QuickConfig.cmake" does NOT
  exist

The system has the packages qt6-base-dev, qt6-base-dev-tools, and qt6-qmltooling-plugins installed.
Maybe there are some additional packages required?


Solution

  • The installation of qt6-declarative-dev solved the issue.

    Additionally, for anyone planning to use Qt Quick, it would be helpful to install the packages qml6-module-qtqml, qml6-module-qtquick, qml6-module-qtquick-controls, qml6-module-qtquick-dialogs, qml6-module-qtquick-window, qml6-module-qtquick-layouts, qml6-module-qtcore.