Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #198 and #199 broken cmake popt detection and use /bin/sh not /bin/bash. #200

Merged
merged 3 commits into from May 18, 2020

Conversation

dbaarda
Copy link
Member

@dbaarda dbaarda commented May 18, 2020

This should fix problems on FreeBSD with cmake's popt detection and running tests without needing /bin/bash.

This fixes our cmake/FindPOPT.cmake by copying official FindPackage() examples and following the instructions for correctly using PkgConfig found here;

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

It also updates cmake/Findlibb2.cmake to follow best practices better, and cleans our FindPackage() handling in CMakeLists.txt.

Finally, it fixes the only test script we had using #!/bin/bash to use #!/bin/sh instead. Apparently FreeBSD doesn't have bash installed by default, and this script doesn't need bash anyway.

dbaarda added 3 commits May 18, 2020
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.
@dbaarda dbaarda merged commit 1cfa7a2 into librsync:master May 18, 2020
1 check passed
@dbaarda dbaarda deleted the fix/findpopt1 branch May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant