On Fri, Oct 11, 2024 at 10:14 AM, Alexander Kanavin wrote: > > On Fri, 11 Oct 2024 at 07:31, Aleksandar Nikolic via > lists.yoctoproject.org > <aleksandar.nikolic010=gmail....@lists.yoctoproject.org> wrote: > >> I have recipe A that builds a cmake project which, among other >> dependencies, also has "find_package(pkgconfig)", so, I inherited the >> pkgconfig class in the recipe. This cmake project is used by other >> projects since it builds a .so, thus I am also exporting the AConfig.cmake >> file, which contains the "find_package(pkgconfig)" call. This works well, >> the project is built and the pkg-config binary is in recipe-sysroot-native >> (as expected). >> >> Recipe B builds another cmake project, which depends on the cmake project >> A. Thus, I added recipe A to recipe B's DEPENDS. As expected, this nicely >> copies everything needed from recipe A (the .so file, the headers, the >> AConfig.cmake and ATargets.cmake, etc.). However, (expectedly?) it does >> not copy the pkg-config binary along with it, thus building recipe B >> fails, because the "find_package(pkgconfig)" call from the AConfig.cmake >> file fails. >> >> Is the above usage of PkgConfig correct? I understand the pkg-config >> binary from recipe A's recipe-sysroot-native should not be copied to >> recipe B's recipe-sysroot-native, but still don't understand how this all >> is supposed to work. Shouldn't all dependencies from recipe A also be >> available for recipe B? >> >> It goes without saying, when I inherit the pkgconfig class in recipe B, >> everything works as expected (because the pkg-config binary is found in >> recipe-sysroot-native of recipe B), but this is also not correct, as >> recipe B does not really depend on pkgconfig and shouldn't even know about >> it. > > Build time dependencies on executables aren't transitive like that. If > A needs executable X during its own build, this does not mean that B > (which requires A) would need that same executable.
I was thinking this, thanks for clearing it up! And yes, this does make sense! > > You either need to split .cmake files to have one for own build of A > (with pkg-config call), and one for consumers of A (without pkg-config > call), or write a bbclass for consumers that contains both DEPENDS on > A and inherit pkgconfig. Hm, I have a question regarding this idea (please ignore it if it goes out of scope for Yocto). The A cmake project calls find_package(PkgConfig) because it uses the command pkg_check_modules(). AFAIK this command just looks for modules, so I need this in every cmake project which depends on A, basically meaning inheriting pkconfig.bbclass is the only solution here. Aleksandar > > Alex
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#64011): https://lists.yoctoproject.org/g/yocto/message/64011 Mute This Topic: https://lists.yoctoproject.org/mt/108943953/21656 Group Owner: yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-