rpm-software-management / librepo

A library providing C and Python (libcURL like) API for downloading packages and linux repository metadata in rpm-md format
http://rpm-software-management.github.io/librepo/
GNU Lesser General Public License v2.1
75 stars 91 forks source link

cmake/tests: add libcheck linkage dependencies #205

Closed lucab closed 4 years ago

lucab commented 4 years ago

This tweaks tests linkage in order to bring in transitive dependencies for libcheck. It fixes linking issues when building tests on systems with a static libcheck library.

lucab commented 4 years ago

Followup to https://github.com/rpm-software-management/librepo/pull/203. I've checked that this builds fine in (at least) the following buildroots:

lucab commented 4 years ago

For context, the build failure is pretty much the same as shown in https://github.com/libcheck/check/issues/60 and the cmake fix in here is also modeled after those additional linking flags.

lukash commented 4 years ago

To me it seems the transitive dependencies shouldn't be part of our CMakeLists.txt. libcheck uses pkg-config, see the output of pkg-config --libs check and pkg-config --libs --static check. The PKG_CHECK_MODULES macro should work for this.

lucab commented 4 years ago

@lukash ah, you are absolutely right, I did not realize the .pc file was already covering all cases. I've amended the PR to use that, how does it looks now?

lukash commented 4 years ago

Thanks @lucab