添加安装前缀“Qt5Widgets”到CMAKE

编程入门 行业动态 更新时间:2024-10-23 18:20:33
本文介绍了添加安装前缀“Qt5Widgets”到CMAKE_PREFIX_PATH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我不知道很多关于cmake,我试图构建一个客户端使用cmake和Qt。获取以下错误:

I don't know a lot about cmake, I'm trying to build a client using cmake and Qt. Getting the following error:

CMake错误at alethzero / CMakeLists.txt:26(find_package):由提供FindQt5Widgets .cmake在CMAKE_MODULE_PATH这个项目 已要求CMake找到由 Qt5Widgets提供的包配置文件,但CMake没有找到一个。

CMake Error at alethzero/CMakeLists.txt:26 (find_package): By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Qt5Widgets", but CMake did not find one.

无法使用以下任何名称找到Qt5Widgets提供的程序包配置文件:

Could not find a package configuration file provided by "Qt5Widgets" with any of the following names:

Qt5WidgetsConfig.cmake qt5widgets-config.cmake

添加安装前缀的Qt5Widgets到CMAKE_PREFIX_PATH或将Qt5Widgets_DIR设置为包含上述文件之一的目录。如果Qt5Widgets提供单独的开发包或 SDK,请确保它已安装。

Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set "Qt5Widgets_DIR" to a directory containing one of the above files. If "Qt5Widgets" provides a separate development package or SDK, be sure it has been installed.

- 配置不完整,

-- Configuring incomplete, errors occurred!

据我所知,我需要添加QT路径到CMake。我该怎么做?我有Qt安装在/ home / user / Programs。我发现的所有解释都是只做这个或那个。我需要确切的终端命令,所以我可以只是学会如何做到在未来。

As far as I understand, I need to add the QT path to CMake. How do I do it? I have Qt installed in /home/user/Programs. All the explanations I find are "just do this or that". I need the exact Terminal commands so I can just learn how to do it in the future.

谢谢!

更新: export CMAKE_PREFIX_PATH = / home / user / Programs 没有帮助我。

推荐答案

这是有记录的:

This is documented:

doc.qt.io/qt-5/cmake-manual.html

The easiest way to use CMake is to set the CMAKE_PREFIX_PATH environment variable to the install prefix of Qt 5

做这个

export CMAKE_PREFIX_PATH=/home/user/Programs/<other_stuff>

其中引用编译器等,以使此完整路径有效:

where references the compiler etc, so that this complete path is valid:

/home/user/Programs/<other_stuff>/bin/qmake*

更多推荐

添加安装前缀“Qt5Widgets”到CMAKE

本文发布于:2023-05-31 10:06:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/389560.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:前缀   Qt5Widgets   CMAKE

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!