I'm trying to build a Qt Quick Controls
application with CMake
. I use the following documentation:
http://doc.qt.io/QtQuickCompiler/qquickcompiler-building-with-cmake.html
When running CMake
, I'm getting this error:
By not providing "FindQt5QuickCompiler.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"Qt5QuickCompiler", but CMake did not find one.
Could not find a package configuration file provided by "Qt5QuickCompiler"
with any of the following names:
Qt5QuickCompilerConfig.cmake
qt5quickcompiler-config.cmake
at this line:
FIND_PACKAGE(Qt5QuickCompiler)
Obviously CMake
doesn't find Qt5QuickCompiler
. I checked in my Qt
folder (C:\Qt) but it's not there. Yet I could run this application with QMake
.
What do I need to set in order to find Qt5QuickCompiler
?
I just stumbled upon the same issue with Qt 5.12 under Linux. The documentation under https://doc.qt.io/QtQuickCompiler/qquickcompiler-building-with-cmake.html currently seems to be wrong.
Use QuickCompiler
after COMPONENTS
in the Qt5 find_package
instead of trying to add it via find_package(Qt5QuickCompiler)
. Adapting the example from the link, use
find_package(Qt5 COMPONENTS Quick Core Network QuickCompiler)
qtquick_compiler_add_resources(RESOURCES example.qrc)
add_executable(myapp ${SRC_LIST} ${RESOURCES)
instead of
find_package(Qt5 COMPONENTS Quick Core Network)
find_package(Qt5QuickCompiler)
qtquick_compiler_add_resources(RESOURCES example.qrc)
add_executable(myapp ${SRC_LIST} ${RESOURCES)
The error is pretty clear: CMake doesn't have a module for the Qt5QuickCompiler to find it. It just doesn't know what it is. I've just checked the corresponding cmake folder and it doesn't have that file. I'm not sure what that Qt documentation page is talking about but there is no such a file in the CMake distribution. Maybe Qt sources have this file somewhere?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With