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("=================================================================")
相关推荐
程与留11 小时前
15_国际化和本地化:tr()、ts 文件、QM 文件、多语言切换
c++·qt
GeW12 小时前
超详细!RHCE10版通用备考策略,内含评分细则解读
linux
用户0413284651313 小时前
Linux 服务开机自启动怎么配置?systemctl enable 原理详解
linux
程与留13 小时前
14_Qt 样式表(QSS)入门(语法、选择器、美化实战)
c++·qt
Quz19 小时前
QML 拖拽篇:接收拖拽与数据交换
qt
草莓熊Lotso21 小时前
【Redis 初阶】Set 类型深度解析:去重集合的运算能力与实战场景
linux·网络·数据库·windows·redis·tcp/ip·缓存
张文君1 天前
ubuntu26.04坏道坏块分区隔离急速版260831-V0.12
linux·python
贝锐1 天前
从国产化信创设备到商用安卓终端,向日葵如何帮助企业实现统一运维管理?
linux·运维·远程控制
Julien20041 天前
调查和解决 SELinux 问题
linux·运维·服务器·网络·学习方法
小张同学a.1 天前
Docker 容器实战 1—— docker 基础与镜像构建
linux·运维·docker·容器