[yocto] shared cmake modules

Henrik Lindblom henriklindblomster at gmail.com
Tue Apr 9 09:27:33 PDT 2019


Your recipes seem a bit off. Doesn't bitbake complain about them at all?

In your logger library you declare a dependency to
"texa-cmake-modules", not "cmake-modules". Also, assuming the naming
conflict is only present in pastebin versions of your recipes, in
cmake-modules.bb you add all files under ${MODULES_DEST_PATH} to both
FILES_${PN}-dev and FILES_${PN}. These variables are used to populate
packages ${PN}-dev and ${PN} respectively. The order in which they
"grab" the files depends on PACKAGES, which has a default value of
"${PN}-dbg ${PN}-staticdev ${PN}-dev ${PN}-doc ${PN}-locale
${PACKAGE_BEFORE_PN} ${PN}". Since ${PN}-dev appears before ${PN} in
this list, your cmake-modules package is most likely empty (I think
this should even yield a QA warning). Furthermore, your
MODULE_DEST_PATH incorrectly points to a path under ${STAGING_DATADIR}
which is also
where you install all your files in do_install(). Correct path for
installation is

${D}${datadir}/cmake/Modules

and for FILES

${datadir}/cmake/Modules/*

Depending on how you fix cmake-modules you likely need to change

DEPENDS = "cmake-modules boost"

to

DEPENDS = "cmake-modules-dev boost"

in your library recipe, adjusting for the actual name of your cmake
module.

See:
https://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-D
https://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-PACKAGES
https://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-FILES

Cheers,
Henrik

On Tue, Apr 9, 2019 at 5:39 PM Gabriele Zampieri <gabbla.malist at gmail.com>
wrote:

> Hi,
>
> yes, following:
>
> - cmake-modules.bb https://pastebin.com/5VqN9msS
> - xxx-log.bb : https://pastebin.com/LYcPW3hc
>
> The first one install the modules, thus is a dependency of many libraries,
> the second one is a simple logger library that uses first's module
>
> Thanks for your help,
> Gabriele
>
>
>
>
>
> Il giorno lun 8 apr 2019 alle ore 19:05 Henrik Lindblom <
> henriklindblomster at gmail.com> ha scritto:
>
>> FILES_${PN}-dev = "${MODULES_DEST_PATH}/*"
>>>
>>
>> Does your library recipe explicitly depend on <cmake_module>-dev? Can you
>> share the failing recipe?
>>
>> Cheers,
>> Henrik
>>
>> On Wed, Apr 3, 2019 at 1:18 PM Gabriele Zampieri <gabbla.malist at gmail.com>
>> wrote:
>>
>>> Hi all,
>>>
>>> I'm setting up a layer that will compile our applications and libraries.
>>> All the applications are based on cmake and they share modules. Before
>>> using yocto I kept the modules in <workspace>/cmake (under version control)
>>> alongside applications and libraries. With yocto I wrote a recipe that
>>> checkout the module repo and install them in
>>> "${STAGING_DATADIR}/cmake/Modules/". I took this path from
>>> "meta/classes/cmake.bbclass". If i build the module target, I get the files
>>> installed in the target recipe datadir. If I want to build a library (that
>>> depends also on my modules recipe) the task do_configure fails because
>>> cmake cannot find none of my include. Digging around I found that the
>>> toolchain.cmake file points to a module location that doesn't exist in the
>>> library workdir, but in module recipe (${STAGING_DATADIR}/cmake/Modules/).
>>>
>>> The module recipe looks like as follow:
>>>
>>> MODULES_DEST_PATH = "${STAGING_DATADIR}/cmake/Modules"
>>> FILES_${PN}-dev = "${MODULES_DEST_PATH}/*"
>>>
>>> do_install() {
>>>     DEST_DIR=${MODULES_DEST_PATH}
>>>
>>>     # Create the destination folder
>>>     install -d $DEST_DIR
>>>     install -m 0444 ${S}/my/module.cmake $DEST_DIR
>>>     ......
>>> }
>>>
>>> So my question is: where should I install the shared modules
>>> (MODULE_DEST_PATH int the above snippet)? and how to update the
>>> CMAKE_MODULE_PATH properly to append that location?
>>>
>>> Thanks,
>>> Gabriele
>>> --
>>> _______________________________________________
>>> yocto mailing list
>>> yocto at yoctoproject.org
>>> https://lists.yoctoproject.org/listinfo/yocto
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20190409/cfb8c9b8/attachment.html>


More information about the yocto mailing list