cmake/FindPOPT.cmake: Add PkgConfig support by ffontaine · Pull Request #186 · librsync/librsync

and others added 2 commits

December 31, 2019 18:23
Add PkgConfig support to retrieve popt dependencies otherwise static
build can fail if popt has been linked with iconv:

[100%] Linking C executable rdiff
/home/buildroot/autobuild/instance-2/output-1/per-package/librsync/host/opt/ext-toolchain/bin/../lib/gcc/powerpc-buildroot-linux-uclibc/8.3.0/../../../../powerpc-buildroot-linux-uclibc/bin/ld: /home/buildroot/autobuild/instance-2/output-1/per-package/librsync/host/powerpc-buildroot-linux-uclibc/sysroot/usr/lib/libpopt.a(poptint.o): in function `POPT_fprintf':
poptint.c:(.text+0x34c): undefined reference to `libiconv_open

Fixes:
 - http://autobuild.buildroot.org/results/896e8e3efbedad90d66ae8c4e1e50f16206cab49

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
It's possible for find_package() to fail, and thus pkg_search_module() will not be available.

Also FIND_PACKAGE_HANDLE_STANDARD_ARGS() should only be needed when PkgConfig didn't work.

This was referenced

May 17, 2020