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

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:250624-qrencode changing 1 files +3 −3
  1. hebasto commented at 8:05 pm on June 24, 2025: member

    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 #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 @ ead44687483e9c936ba970de890c01d5e7ad3485:
    0% cmake -B build -DBUILD_GUI=ON
    1<snip>
    2-- Found QRencode: /usr/local/lib/libqrencode.dylib (found version "4.1.1")
    3<snip>
    
    • this PR:
    0% cmake -B build -DBUILD_GUI=ON
    1<snip>
    2-- Found QRencode: /usr/local/Cellar/qrencode/4.1.1/lib/libqrencode.dylib (found version "4.1.1")
    3<snip>
    
  2. cmake: Use `HINTS` instead of `PATHS` in `find_*` commands
    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.
    ead4468748
  3. hebasto added the label Build system on Jun 24, 2025
  4. hebasto added the label Needs backport (29.x) on Jun 24, 2025
  5. DrahtBot commented at 8:05 pm on June 24, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32805.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK fanquake
    Concept ACK purpleKarrot

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  6. maflcko added this to the milestone 29.1 on Jun 25, 2025
  7. fanquake commented at 1:10 pm on June 25, 2025: member
  8. purpleKarrot commented at 1:45 pm on June 25, 2025: contributor

    utACK

    Nit: Is there a problem on master? It looks like the result from libqrencode.pc is ignored, but if that is not causing actual problems, maybe pkg_check_modules could be dropped from FindQRencode.cmake? Also, what platforms actually provide the qrencoded library in the Debug configuration?

  9. hebasto commented at 4:34 pm on June 25, 2025: member

    @purpleKarrot

    Thank you for the review!

    Nit: Is there a problem on master?

    In terms of build failure – no. In terms of needlessly including overly broad paths like /usr/local/include or /opt/homebrew/include on macOS – yes.

    It looks like the result from libqrencode.pc is ignored…

    It depends on the platform used for building. On macOS, that’s the case on the master branch, but not with this PR.

    … if that is not causing actual problems, maybe pkg_check_modules could be dropped from FindQRencode.cmake?

    I believe that for packages providing *.pc files, this is the most reliable and widely accepted approach for the find module.

    Also, what platforms actually provide the qrencoded library in the Debug configuration?

    vcpkg does.

  10. fanquake commented at 11:09 am on June 26, 2025: member
    ACK ead44687483e9c936ba970de890c01d5e7ad3485
  11. fanquake merged this on Jun 26, 2025
  12. fanquake closed this on Jun 26, 2025

  13. hebasto deleted the branch on Jun 26, 2025
  14. fanquake referenced this in commit a990c1002b on Jun 26, 2025
  15. fanquake removed the label Needs backport (29.x) on Jun 26, 2025
  16. fanquake commented at 11:13 am on June 26, 2025: member
    Backported to 29.x in #32810.

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-06-28 15:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me