如何在适用于Yocto的正确位置为Autotools库部署Find * .cmake文件? [英] How to deploy a Find*.cmake file for an Autotools library in the correct place for Yocto?
问题描述
我为公司项目在现有Yocto git上创建了一个新层.
在这一层中,我添加了一些基于外部autotools
的库.
一些应用程序需要链接到该库,并且应用程序项目均基于cmake
.
使用其中一个库(例如 libcoap ),我可以轻松地找到一些 谢谢. 要将FindFoo.cmake与尚未完成的cmake项目一起交付 理想的方法是更新上游项目本身.因此,您将适当地更新配方并打包 如果您现在想这样做: 要通过其他食谱使用该cmake 通常的方法是将 CMake模块包装在各种配方中,例如: 您的应用程序基于cmake,因此您将在配方中使用 (顺便说一句,我对libcoap) I could easily find some Now if I was running on PC, it would simply be a matter of placing this Should I try to get Thanks in advance. To ship FindFoo.cmake with non-yet-cmake project The ideal way is to update upstream project itself. So you will update your recipe and package If you want to do it right now: To use that cmake by other recipe The usual way is to package CMake modules are packaged in various recipes for example: Your application is cmake based, so you will use (BTW, I do a build test of libcoap recipe from homeassistant layer and it worked, but obviously there is no cmake shipped.) 这篇关于如何在适用于Yocto的正确位置为Autotools库部署Find * .cmake文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!FindFoo.cmake
.
FindFoo.cmake
添加到您的图层中(到配方旁边的files
目录中.)SRC_URI
(即SRC_URI += "file://FindFoo.cmake"
).do_install
中的目录${D}${datadir}/cmake/Modules/
中.FILES_${PN}-dev
变量将其打包到dev软件包中(请参见下面的示例配方)..cmake
文件打包到${PN}-dev
软件包中.在您的情况下,您的应用程序(取决于libcoap)将只设置DEPENDS = "libcoap"
,并且所有需要的文件(例如标头,库和cmake文件)都将被复制(以及硬链接)到应用程序的sysroot.>
inherit cmake
.本机模块搜索路径在 cmake中设置.bbclass .FindCoAP.cmake
to add to my library recipe.FindCoAP.cmake
file in cmake
's ${CMAKE_ROOT}/Modules
dir, but how should I, from inside a bitbake
recipe (do_install hook), proceed to make my Find*.cmake
modules available to anyone's dependent projects? Yocto
's cmake
CMAKE_ROOT
variable from system-information like this or is it a safer and more reliable way?do_install_append() {
cmake --system-information | grep CMAKE_ROOT | cut -d \" -f2
install -d ${D}/$CMAKE_ROOT}/Modules
install ${S}/FindCoAP.cmake ${D}/$CMAKE_ROOT}/Modules
}
FindFoo.cmake
appropriately.
FindFoo.cmake
to your layer (into the files
directory next to your recipe).SRC_URI
(i.e. SRC_URI += "file://FindFoo.cmake"
).do_install
into the directory ${D}${datadir}/cmake/Modules/
for example.FILES_${PN}-dev
variable (see example recipes below)..cmake
files into the ${PN}-dev
package. In your case, your application (which depends on the libcoap) will just set DEPENDS = "libcoap"
and all the needed files (like headers, libraries and cmake file) will be copied (well, hardlinked) to the sysroot of your application.inherit cmake
in the recipe. Native module search path is set in cmake.bbclass.