Reputation: 71
I have a QML project want to run with Cmake
I have Qt 5.10.1 its Support QtQuick 2.10 and QtQuickControl 2.3
But when I build my project this error show
module "QtQuick" version 2.9 is not installed
I use this code to import QtQuick
find_package(Qt5Quick REQUIRED)
But I think this not search at my Home directory that i install my Qt because when I decrease version of QtQuick to 2.5 in my main.qml file the error solve and this error show
module "QtQuick.Controls" version 2.2 is not installed
Question is: how Can import my Home directory QtQuick and QtQuickControls in my Cmake or any other idea?
Upvotes: 1
Views: 1026
Reputation: 2388
Did you also link it to your executable? The following works for me:
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5Core)
find_package(Qt5Quick REQUIRED)
find_package(Qt5Qml REQUIRED)
add_executable (myApp ${SOURCES})
target_link_libraries(myApp Qt5::Core)
target_link_libraries(myApp Qt5::Qml)
target_link_libraries(myApp Qt5::Quick)
Upvotes: 1