On Sat, Oct 12, 2024 at 11:00 AM, Alexander Kanavin wrote:

> 
> But what is it actually checking for? Is it something that only A
> would need? If so, then why consumers of A are forced to use the same
> file which contains checks for things they don't actually use?

It is checking for gstreamer libraries. Here's a bit more context, it can very 
well be though, that we are using find_package(...) wrongly when it comes to 
Yocto.

Recipe / Project A

Note that the below code snippet is as-is and that I have issues with this 
because the Targets.cmake file eventually contains host paths, meaning when the 
recipe is not built from scratch but pulled from the sstate-cache for example, 
the build fails because the Targets.cmake file contains paths to 
recipe-sysroot, which in the second case do not exist. But this is another 
issue, I don't want to bother you with it. Anyway, the code snippet:

find_package(PkgConfig)
pkg_check_modules(GST REQUIRED gstreamer-1.0>=1.4)
target_include_directories(A PUBLIC ${GST_INCLUDE_DIRS})
target_compile_options(A PUBLIC ${GST_CFLAGS})
target_link_libraries(A PUBLIC ${GST_LIBRARIES})

Additionally (and I believe this is _the_ issue), our every CMake project 
writes and exports an additional cmake file, called Deps.cmake, which (1) 
contains all the dependencies (find_package(...) calls) and (2) is through the 
Config.cmake file included by the consumer projects. This means that consumers 
also call find_package(PkgConfig) through this Config.cmake file, which, if 
pkgconfig is not inherited, fails (as in this case).

While writing this, it occurred to me whether we really need to export the 
Deps.cmake file and especially find_package(PkgConfig) line. So I just 
performed two tests: (1) I removed the find_package(PkgConfig) line from our 
Deps.cmake file and (2) I completely removed the export of the Deps.cmake file. 
The result: the Yocto build works in both cases, so I am wondering why we even 
export the Deps.cmake file through Config.cmake... Maybe because we also build 
on Windows/Ubuntu and export our packages with Conan, I'll double check with my 
colleagues next week.

Aleksandar

> 
> Alex
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#64015): https://lists.yoctoproject.org/g/yocto/message/64015
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]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to