Fix #198 and #199 broken cmake popt detection and use /bin/sh not /bin/bash. by dbaarda · Pull Request #200 · librsync/librsync

added 3 commits

May 19, 2020 00:23
This fixes the cmake popt detection on (at least) FreeBSD. It mostly worked by
accident on other platforms like Debian because of standardized install
locations aligning with our miss-used output vars.

In CMakeLists.txt bump cmake_minimum_required to 3.6 for a working version of
pkg_search_module() with IMPORTED_TARGET support. The version on our travis
xenial test platform is 3.12.4, so 3.6 is rather old. Fix BZIP2 detection to
use the correct BZIP2_INCLUDE_DIRS var. Add POPT status messages to match
other find_package() handling. Remove redundant "Found..." messages from all
find_package() handling.

In cmake/FindPOPT.cmake use pkg_search_module() IMPORTED_TARGET support to
create a PkgConfig::POPT target and use it, following instructions found here;

https://stackoverflow.com/questions/29191855/what-is-the-proper-way-to-use-pkg-config-from-cmake

Follow a pattern from official FindPackage modules of using cached vars
POPT_LIBRARY_RELEASE/POPT_IMPORT_DIR to set uncached vars
POPT_LIBRARIES/POPT_IMPORT_DIRS. This makes it behave almost exactly like
offical FindPackage modules.

In cmake/Findlibb2.cmake update it to also use the more standard
cached/uncached vars pattern.
This fixes testing on FreeBSD, which doesn't install bash by default, and even
when it does, it puts it in a /usr/local/bin.