一、编译qt6.2.0源码
1、下载qt6.2.0源码包
2、解压源码包,进入源码根目录执行:
./configure -release -static -opensource -confirm-license -prefix /home/Qt/6.2.0/static/
3、配置完成之后执行make编译。
二、使用cmake构建qt工程
cmake_minimum_required(VERSION 3.16)
project(qt_demo)
SET(CMAKE_PREFIX_PATH ${DIR}/qt-6.2.0/lib/cmake)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
find_package(Qt6 COMPONENTS
Core
Gui
Widgets
REQUIRED)
add_executable(qt_demo main.cpp mainwindow.cpp mainwindow.h mainwindow.ui)
target_link_libraries(qt_demo
Qt::Core
Qt::Gui
Qt::Widgets
)
|