[yocto] Basic Yocto+CMake Usage question

Patrick Boettcher patrick.boettcher at posteo.de
Thu Mar 28 09:30:42 PDT 2019


On Thu, 28 Mar 2019 12:20:43 -0400
A <aaron.biver at gmail.com> wrote:

> I'm having issues with a yocto build that is combining recipes that
> should depend on each other, and I need a sanity check.  Is this an
> ok forum for stupid user questions?
> The main idea is to have one recipe install some prebuilt libraries,
> and have another cmake-based recipe use those libraries.
> As a caveat, this is a native version of the build that I seem to be
> having trouble with, but I assume that is mostly irrelevant:
> In ProjectA, the meat of the matter is a do_install that copies
> ProjectA*.so into STAGING_LIBDIR.  I don't recall why I chose that
> instead of ${D}${libdir}... is it ok this way?
> In ProjectB, I'd like CMake's find_library() to find Project A's
> libraries, and I seem to be having trouble.
> How would you approach this?  The recipe for Project B contains
> "inherit cmake" and some variables I pass in with an EXTRA_OECMAKE
> and an EXTRA_OECMAKE-native.
> I also have there:
> DEPENDS += "ProjectA"
> DEPENDS_class-native = "ProjectA-native"
> However,in ProjectB's find_library() call, I am uncertain how to
> direct it to find those libraries - what PATHS or HINTS or whatever?

I was having similar problems with this (a dependency for zeromq in my

  DEPENDS = "zeromq" # build dependency

I had to add the following variable to my recipes:


this, iiuc, tells cmake that in case of cross-compiling (via a
toolchain-file) that it shall also look in the sysroot for header
and library-files when doing find_library(). Not sure if it will work
with all find_package()-modules.

It worked, I haven't investigated further why, but I should have.


More information about the yocto mailing list