HomePhabricator

[CMAKE] Fix issues when looking for libraries installed with homebrew

Description

[CMAKE] Fix issues when looking for libraries installed with homebrew

Summary:
This diff fixes a few issues with the current usage of the brew prefix:

  • The brew prefix is added to the search path for the libraries files as HINTS, which cause it to be searched before system libraries. However this path does not follow the same rule as the other paths, as the include or lib subdirectories are not traversed. These suffixes needs to be added manually for the search to succeed.
  • The find_brew_prefix() function checks if the variable name is defined to prevent calling brew multiple times. The find package modules all use the same BREW_HINT variable name, which can cause shadowing issues if they are called from the same scope (which happens).
  • There is a copy/paste issue in the FindEvent package which looks for the wrong prefix.

These bugs have been revealed as some brew packages (namely Berkeley DB)
stopped putting symlinks to the standard system path, and caused the
macOS build to fail.

Test Plan:
I manually removed the symlinks to the system path on my OSX machine,
and check that cmake finds the files at the expected location.

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D7441

Details

Provenance
FabienAuthored on Sep 15 2020, 18:36
abc-botPushed on Sep 15 2020, 18:40
Reviewer
Restricted Project
Differential Revision
D7441: [CMAKE] Fix issues when looking for libraries installed with homebrew
Parents
rABC45575debdce8: [CI] Add the failed functional tests tmp directories to artifacts
Branches
Unknown
Tags
Unknown