ubuntu cmake使用自己版本的qt

给一篇文章参考
https://blog.csdn.net/bank_dreamer/article/details/138678909

自己使用的范例

cpp 复制代码
set(Qt5_DIR "/home/peak/Qt5.14.0/5.14.0/gcc_64/lib/cmake/Qt5")

# 设置Qt5的安装目录
#set(CMAKE_PREFIX_PATH "/home/peak/Qt5.14.0")

find_package(Qt5 COMPONENTS 
                 Widgets 
                 Network 
                 SerialPort 
                 SerialBus 
                 Sql 
                 Multimedia 
                 RemoteObjects 
                 Gui)

MESSAGE("=================================================================")
if(DEFINED Qt5_FOUND)

    MESSAGE(STATUS "find Qt5_FOUND: ${Qt5_FOUND}")
    MESSAGE(STATUS "Qt5Widgets_INCLUDE_DIRS: ${Qt5Widgets_INCLUDE_DIRS}")
    MESSAGE(STATUS "Qt5Multimedia_INCLUDE_DIRS: ${Qt5Multimedia_INCLUDE_DIRS}")
    MESSAGE(STATUS "Qt5MultimediaWidgets_INCLUDE_DIRS: ${Qt5MultimediaWidgets_INCLUDE_DIRS}")
    MESSAGE(STATUS "Qt5SerialPort_INCLUDE_DIRS: ${Qt5SerialPort_INCLUDE_DIRS}")
    MESSAGE(STATUS "Qt5Gui_INCLUDE_DIRS: ${Qt5Gui_INCLUDE_DIRS}")

    include_directories(${Qt5Widgets_INCLUDE_DIRS})
    include_directories(${Qt5Multimedia_INCLUDE_DIRS})
    include_directories(${Qt5Gui_INCLUDE_DIRS})
    include_directories(/home/peak/Qt5.14.0/5.14.0/gcc_64/include/QtGui/5.14.0)
    include_directories(/home/peak/Qt5.14.0/5.14.0/gcc_64/include/QtCore/5.14.0)

else()
    MESSAGE(STATUS "not find Qt5_FOUND: ${Qt5_FOUND}")
endif()
MESSAGE("=================================================================")
相关推荐
Tianwen_Burning15 分钟前
qt控件QVTKOpenGLNativeWidget全窗口显示
qt·pcl·halcon3d
学好statistics和DS32 分钟前
命令替换(Command Substitution)详解
linux
zimoyin32 分钟前
浅浅了解下0拷贝技术
java·linux·开发语言
ba_pi1 小时前
每天写点什么2026-01-09-linux基础
linux·运维·服务器
wdfk_prog1 小时前
[Linux]学习笔记系列 -- 底层CPU与体系结构宏
linux·笔记·学习
行走的bug...1 小时前
cmake总结
linux·运维·服务器
zfxwasaboy1 小时前
DRM KMS 子系统(3)CRTC
linux·c语言
凌波粒1 小时前
Linux 面试题篇
linux·运维·服务器
Joren的学习记录1 小时前
【Linux运维疑难杂症】k8s集群创建calico网络失败
linux·运维·kubernetes
小CC吃豆子2 小时前
Qt的信号与槽机制
开发语言·数据库·qt