Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To connect the appropriate version of a shared library from a Yocto recipe, one can:

  1. Include the shared library in the recipe by adding it to the recipe's FILES variable.

  2. Set the library's version using the PN-${PV} variable. For example, PN-${PV}.so.1.

  3. Use the pkg-config tool to locate and link against the library.

  4. Specify the library's path in the linker flags using the -L option, and the library's name using the -l option.

For example, if the shared library is named libfoo.so.1, and its Yocto recipe installs it to /usr/lib, one can connect to it by including these flags in a CMake target:

add_executable(my_target my_source.cpp)
target_link_libraries(my_target
    -L/usr/lib
    -lfoo
)