Merge bitcoin/bitcoin#32805: cmake: Use HINTS instead of PATHS in find_* commands

ead4468748 cmake: Use `HINTS` instead of `PATHS` in `find_*` commands (Hennadii Stepanov)

Pull request description:

  According to the CMake documentation, `HINTS` "should be paths computed by system introspection, such as a hint provided by the location of another item already found", which is precisely the case in the `FindQRencode` module.

  Entries in `HINTS` are searched before those in `PATHS`. On macOS, Homebrew’s `libqrencode` will therefore be located at its real path rather than via the symlink in the default prefix.

  A backport to 29.x is required for https://github.com/bitcoin/bitcoin/pull/32804, as this change prevents contamination of include directories by broad locations such as `/usr/local/include` or `/opt/homebrew/include`, which take precedence over Qt’s `-iframework` flags.

  Below is the relevant change in the configuration logs on my macOS 15.5 `x64`:
  - master branch @ ead4468748:
  ```
  % cmake -B build -DBUILD_GUI=ON
  <snip>
  -- Found QRencode: /usr/local/lib/libqrencode.dylib (found version "4.1.1")
  <snip>
  ```
  - this PR:
  ```
  % cmake -B build -DBUILD_GUI=ON
  <snip>
  -- Found QRencode: /usr/local/Cellar/qrencode/4.1.1/lib/libqrencode.dylib (found version "4.1.1")
  <snip>
  ```

ACKs for top commit:
  fanquake:
    ACK ead4468748

Tree-SHA512: 1f0b04e3efeb7fe3efbb969be911abbcf56030d715acd87c0fbaf24422cdf1122f169e32242571256916c96a159212842e1e73092145c63ecc495ce429c6e587
This commit is contained in:
merge-script
2025-06-26 12:10:00 +01:00

View File

@ -21,16 +21,16 @@ endif()
find_path(QRencode_INCLUDE_DIR
NAMES qrencode.h
PATHS ${PC_QRencode_INCLUDE_DIRS}
HINTS ${PC_QRencode_INCLUDE_DIRS}
)
find_library(QRencode_LIBRARY_RELEASE
NAMES qrencode
PATHS ${PC_QRencode_LIBRARY_DIRS}
HINTS ${PC_QRencode_LIBRARY_DIRS}
)
find_library(QRencode_LIBRARY_DEBUG
NAMES qrencoded qrencode
PATHS ${PC_QRencode_LIBRARY_DIRS}
HINTS ${PC_QRencode_LIBRARY_DIRS}
)
include(SelectLibraryConfigurations)
select_library_configurations(QRencode)