I am trying to get Qt6 working on my Raspberry Pi 4 B 2GB. It's running Ubuntu 22.04. I installed all necessary packages with qt6-base-dev
and any dependent packages (build-essential
, cmake
and so on)
But I can't get QT to work with it. I keep getting the error Unknown CMake command "qt_standard_project_setup"
My CMakeLists.txt
looks like this:
cmake_minimum_required(VERSION 3.22)
project(test LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
find_package(Qt6 REQUIRED COMPONENTS Widgets Core)
qt_standard_project_setup()
add_executable(test
main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
)
target_link_libraries(test PRIVATE
Qt6::Widgets
)
I also passed the Qt install path via -DCMAKE_PREFIX_PATH=...
but it doesn't work.
It doesn't seem like it fails to find the QT6 package, it seems to just not recognize the qt_standard_project_setup()
itself, which seems weird to me. Why is this happening?