[yocto] shared cmake modules

Gabriele Zampieri gabbla.malist at gmail.com
Wed Apr 3 03:07:02 PDT 2019


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20190403/655c5f63/attachment.html>


More information about the yocto mailing list