Page MenuHomePhabricator

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

Authored by Fabien on Sep 14 2020, 22:41.

Details

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.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable