在Yocto中使用Cmake构建Qt5
Build Qt5 with Cmake in Yocto
我们正在Yocto/Bitbake中使用Cortex ARM 9的CMake交叉编译我们的Qt5应用程序。
无论我做什么,我都无法让Cmake找到所需的Qt5Config.cmake
配置文件。
错误信息是众所周知的:
CMake Error at CMakeLists.txt:71 (find_package):
By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5" with any of
the following names:
Qt5Config.cmake
qt5-config.cmake
Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
to a directory containing one of the above files. If "Qt5" provides a
separate development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred!
到目前为止,这个背诵者似乎还不错。我依赖Qt并使用Cmake通过:
RDEPENDS_${PN} += " qtconnectivity "
inherit pkgconfig cmake
不幸的是,我对两件事不确定:
当我构建Yocto(在2个内核上(时,为什么bitbake在我的错误配方之前或同时构建
qt5
包?难道依赖关系不应该解决这个问题吗?我也尝试使用DEPENDS
而不是RDEPENDS
,但这并没有什么区别。我不知道哪个系统根Qt正在安装。当我做
find . -name Qt5Config.cmake
时,我发现了很多地方。其中一个地方看起来比其他地方更有希望。它是:./tmp/sysroots-components/cortexa9hf-neon-mx6qdl/qtbase/usr/lib/cmake/Qt5/Qt5Config.cmake
。但是,Qt-lib不应该在"我的食谱"的系统根目录中吗?
所以,毕竟,我试图让CMake
知道Qt5Config.cmake
的位置。我尝试设置
export Qt5_DIR = "/home/vagrant/build/tmp/sysroots-components/cortexa9hf-neon-mx6qdl/qtbase/usr/lib/cmake/Qt5/"
并且可以用CMake输出确认它知道路径CCD_ 9。此外,在CMake中设置路径(使用set(Qt5_DIR ...)
(也没有帮助。
路径仍然未知。即使我现在很乐意让CMake了解Qt5在哪里,但似乎有一个错误的配置,因为我认为我的食谱应该自动知道Qt。
我还能尝试什么?
终于抽出时间回答了。有一段时间我遇到了同样的问题,并发现了cmake_qt5 bitbake类。
使用这个类代替cmake
应该填充在Yocto项目中使用Qt5和CMake所需的所有必要标志。
您只需要继承类cmake_qt5,并确保您像那样分配do_install((
# Recipe created by recipetool
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)
# Unable to find any files that looked like license statements. Check the accompanying
# documentation and source headers and set LICENSE and LIC_FILES_CHKSUM accordingly.
#
# NOTE: LICENSE is being set to "CLOSED" to allow you to at least start building - if
# this is not accurate with respect to the licensing of the software being built (it
# will not be in most cases) you must specify the correct value before using this
# recipe for anything other than initial testing/development!
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""
S="${WORKDIR}"
SRC_URI = "file://login.tar"
DEPENDS += "qtbase wayland"
# NOTE: unable to map the following CMake package dependencies: Qt QT
inherit cmake
inherit cmake_qt5
# Specify any options you want to pass to cmake using EXTRA_OECMAKE:
EXTRA_OECMAKE = ""
do_install(){
install -d ${D}${sbindir}
install -m 0755 ${WORKDIR}/build/login_system ${D}${sbindir}/login_system
}
- 用CMake构建C++协议
- 最小的CMake构建为Android
- 在Cmake构建CmakeList.txt中读取/解析XML文件
- 如何使用CPack打包多个cmake构建结果?
- Vcpkg Pango CMake 构建失败缺少头文件
- 使用纯 CMake 构建 SFML 时出现运行时错误
- 在 Linux 上使用 CMake 构建 gRPC C++
- 用cmake构建比特币
- 使用CMAKE构建和安装静态库
- OpenCV cmake构建总是在Windows中抛出错误
- 在Yocto中使用Cmake构建Qt5
- 在OSx:ld上使用CMake构建C++项目:找不到体系结构x86_64的符号
- 使用cmake构建google测试单元测试时出现链接器错误
- 尝试使用 MinGW/CMake 构建 GLFW 示例时未定义的引用
- 如何从 Linux 控制台使用 CMake 构建 Eclipse C++ 项目(没有可用的 GUI)
- cmake:构建依赖于非源文件.Qt帮助生成
- 使用 CMake 构建 {fmt} 时出现问题
- C++ CMake 构建错误:未定义对"boost::throw_exception(std::exception const&)"的引用
- 在Travis中为CMAKE构建指定编译器版本
- cmake:构建可执行文件并库并链接它们