cmake: Check dependencies after build option interaction #33974

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:251130-cmake-options changing 2 files +92 −73
  1. hebasto commented at 3:50 pm on November 30, 2025: member

    At present, CMakeLists.txt interleaves configuration-option handling with dependency discovery. As a result, unnecessary checks may be performed. For example:

     0$ cmake -B build --preset dev-mode -DBUILD_FOR_FUZZING=ON
     1<snip>
     2-- Found PkgConfig: /usr/bin/pkg-config (found version "2.3.0")
     3-- Found ZeroMQ: /usr/lib64 (found suitable version "4.3.5", minimum required is "4.0.0")
     4-- Performing Test HAVE_USDT_H
     5-- Performing Test HAVE_USDT_H - Success
     6-- Found USDT: /usr/include
     7-- Found QRencode: /usr/lib64/libqrencode.so (found version "4.1.1")
     8-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
     9-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
    10-- Found Threads: TRUE
    11-- Performing Test HAVE_STDATOMIC
    12-- Performing Test HAVE_STDATOMIC - Success
    13-- Found WrapAtomic: TRUE
    14-- Found OpenGL: /usr/lib64/libOpenGL.so
    15-- Found WrapOpenGL: TRUE
    16-- Found WrapVulkanHeaders: /usr/include
    17-- Found Qt: /usr/lib64/cmake/Qt6 (found suitable version "6.10.1", minimum required is "6.2")
    18CMake Warning at CMakeLists.txt:206 (message):
    19  BUILD_FOR_FUZZING=ON will disable all other targets and force
    20  BUILD_FUZZ_BINARY=ON.
    21
    22<snip>
    

    This PR restructures the code to ensure that all dependencies are checked only after the final build option interaction.

  2. hebasto added the label Build system on Nov 30, 2025
  3. DrahtBot commented at 3:51 pm on November 30, 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/33974.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK BrandonOdiwuor
    Stale ACK sedited

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #33861 (build: Bump VS minimum supported version to 18.0 by hebasto)
    • #31723 (qa: Facilitate debugging bitcoind inside functional tests by hodlinator)
    • #31507 (build: Use clang-cl to build on Windows natively by hebasto)
    • #31425 (RFC: Riscv bare metal CI job by sedited)
    • #28792 (build: Embedded ASMap [3/3]: Build binary dump header file by fjahr)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  4. DrahtBot added the label CI failed on Nov 30, 2025
  5. hebasto force-pushed on Nov 30, 2025
  6. DrahtBot removed the label CI failed on Nov 30, 2025
  7. DrahtBot added the label Needs rebase on Dec 1, 2025
  8. hebasto force-pushed on Dec 1, 2025
  9. DrahtBot removed the label Needs rebase on Dec 1, 2025
  10. in CMakeLists.txt:256 in 56d0a0929d
    251+    find_package(QRencode MODULE REQUIRED)
    252+    set(USE_QRCODE TRUE)
    253+  endif()
    254+endif()
    255+
    256+
    


    sedited commented at 7:53 am on December 5, 2025:
    Nit: Extra line.

    hebasto commented at 12:15 pm on December 5, 2025:
    Thanks! Fixed.
  11. sedited approved
  12. sedited commented at 10:58 am on December 5, 2025: contributor

    ACK 56d0a0929d8974a490c57bf84a994ba7c9f19863

    Guix build:

     05bd1a78f590d48e5ceb5815b5ed346d06d738871c9ea26b754c9a851dcb7ee85  guix-build-56d0a0929d89/output/aarch64-linux-gnu/SHA256SUMS.part
     1cc0525310c1e1c1b1cb69c2256b8089b187830c27da9dd7ba9830884c35a0e95  guix-build-56d0a0929d89/output/aarch64-linux-gnu/bitcoin-56d0a0929d89-aarch64-linux-gnu-debug.tar.gz
     2bc891ef995772a5f09c48000b0b0e7d6dc142ae184490ef711c800f42c48cdeb  guix-build-56d0a0929d89/output/aarch64-linux-gnu/bitcoin-56d0a0929d89-aarch64-linux-gnu.tar.gz
     3c1da46ecfaec3c3e040a6504182faf5f114cdbb69926757b1b10192e11919c2c  guix-build-56d0a0929d89/output/arm-linux-gnueabihf/SHA256SUMS.part
     45d5e6287f0369f662526d3af08041e7544bed163c41421d8c81be97b522d0c89  guix-build-56d0a0929d89/output/arm-linux-gnueabihf/bitcoin-56d0a0929d89-arm-linux-gnueabihf-debug.tar.gz
     5b4752c479a4a26930d00eb7b775f70744d73a6adbb06ea6d1f5a9542841ab994  guix-build-56d0a0929d89/output/arm-linux-gnueabihf/bitcoin-56d0a0929d89-arm-linux-gnueabihf.tar.gz
     6f73e98957bad390793b82c9d0d60d1733723e57335bcd2535d942e3931297219  guix-build-56d0a0929d89/output/arm64-apple-darwin/SHA256SUMS.part
     7a82dea7564ffa2fe233d758778315aebcb1d9df4f0e5c637d2068512c5a8377a  guix-build-56d0a0929d89/output/arm64-apple-darwin/bitcoin-56d0a0929d89-arm64-apple-darwin-codesigning.tar.gz
     8f1efcb20c5c4316b54b29b3cbb7b13346df2429d21cb80cf539397b879ce490e  guix-build-56d0a0929d89/output/arm64-apple-darwin/bitcoin-56d0a0929d89-arm64-apple-darwin-unsigned.tar.gz
     94fb3b6f31c33b06cfa209235efa45129b4fc0b6914614f9760d697563d62e286  guix-build-56d0a0929d89/output/arm64-apple-darwin/bitcoin-56d0a0929d89-arm64-apple-darwin-unsigned.zip
    10f0403ed60ea3aa384c072fb669e42991336a1b0e55e469e31832a56ee39d77a3  guix-build-56d0a0929d89/output/dist-archive/bitcoin-56d0a0929d89.tar.gz
    113a14924b8009db324534962b571987a5cc739e79206193bddf486af4d4b1d311  guix-build-56d0a0929d89/output/powerpc64-linux-gnu/SHA256SUMS.part
    1214015dd634a12d7280f1a6566ee751985b94b6fc2977dcd145d1e3e7a19becd5  guix-build-56d0a0929d89/output/powerpc64-linux-gnu/bitcoin-56d0a0929d89-powerpc64-linux-gnu-debug.tar.gz
    13b20eab5ad318339ef0ef68246780836a3ea0a50a9d7f9ff321082bffcbe628b8  guix-build-56d0a0929d89/output/powerpc64-linux-gnu/bitcoin-56d0a0929d89-powerpc64-linux-gnu.tar.gz
    143c95edab2bf41192162392cd5fac69973974cbba4098e79da26abdc26ddf2a02  guix-build-56d0a0929d89/output/riscv64-linux-gnu/SHA256SUMS.part
    155897b2f595df0121e12075373343d6244375fb54067af692d6ed220b6925fcba  guix-build-56d0a0929d89/output/riscv64-linux-gnu/bitcoin-56d0a0929d89-riscv64-linux-gnu-debug.tar.gz
    169494532acad032a435b4cc0c6b0c2faef8e333a7b561515d236ed98acafff038  guix-build-56d0a0929d89/output/riscv64-linux-gnu/bitcoin-56d0a0929d89-riscv64-linux-gnu.tar.gz
    1758f758b7db06e5f76457f366b86a16b6d4994274c8dfedd3f6a4bb7c8938bc02  guix-build-56d0a0929d89/output/x86_64-apple-darwin/SHA256SUMS.part
    188720f905960ba7fc7e7625614236b587176380bb0b33cbe2c3ccc28ea1af7929  guix-build-56d0a0929d89/output/x86_64-apple-darwin/bitcoin-56d0a0929d89-x86_64-apple-darwin-codesigning.tar.gz
    19655b68f2ae7ef9cf4f54be47cda3fec98aa8b086bd616921a61904109da15108  guix-build-56d0a0929d89/output/x86_64-apple-darwin/bitcoin-56d0a0929d89-x86_64-apple-darwin-unsigned.tar.gz
    205020c9f35a2584cb7fcf210815b53f509b8da624ffe7ce953b22f1bfe0510d2a  guix-build-56d0a0929d89/output/x86_64-apple-darwin/bitcoin-56d0a0929d89-x86_64-apple-darwin-unsigned.zip
    2105fda737070cc821214064a2d5ef9bc15fc0b6b76d2df3b2b64c52d8c309c115  guix-build-56d0a0929d89/output/x86_64-linux-gnu/SHA256SUMS.part
    22a23759a540eb48c6695b0583fe30fbc994f9a89b70de996499e7304bd24e9b59  guix-build-56d0a0929d89/output/x86_64-linux-gnu/bitcoin-56d0a0929d89-x86_64-linux-gnu-debug.tar.gz
    231de1e23e698a6f23b9e69c96e65237f2a26a77d3da19b6fefe9386d7ada7f076  guix-build-56d0a0929d89/output/x86_64-linux-gnu/bitcoin-56d0a0929d89-x86_64-linux-gnu.tar.gz
    24df33c8b9e987fbeb0aa2fbfada49b24c596b63a4a9f6c6daf56168ade90bfb14  guix-build-56d0a0929d89/output/x86_64-w64-mingw32/SHA256SUMS.part
    2590fdb394150627d7dd85c407d56ae6a50cc7fb4e64ab95d916523515b4879724  guix-build-56d0a0929d89/output/x86_64-w64-mingw32/bitcoin-56d0a0929d89-win64-codesigning.tar.gz
    26b5d3df18b6f6de5809da5fdec697f2e4fcbc8b4635331d4214507b4c40b837a0  guix-build-56d0a0929d89/output/x86_64-w64-mingw32/bitcoin-56d0a0929d89-win64-debug.zip
    273902aa61740e4f74d4aa39b64849a1234c3bf28524298c382c4db556e1b5977f  guix-build-56d0a0929d89/output/x86_64-w64-mingw32/bitcoin-56d0a0929d89-win64-setup-unsigned.exe
    28eb3bccca9af379f2cee04fbe42c0441988ff558c514c04d9d7fa003f325a13ac  guix-build-56d0a0929d89/output/x86_64-w64-mingw32/bitcoin-56d0a0929d89-win64-unsigned.zip
    
  13. cmake: Check dependencies after build option interaction 05b92e1ffb
  14. in CMakeLists.txt:158 in 56d0a0929d outdated
    153@@ -202,6 +154,9 @@ target_link_libraries(core_interface INTERFACE
    154   $<$<CONFIG:Debug>:core_interface_debug>
    155 )
    156 
    157+#=============================
    158+# Option interaction
    


    fanquake commented at 11:05 am on December 5, 2025:
    What is this comment meant to be?

    hebasto commented at 11:08 am on December 5, 2025:
    Some build options, such as BUILD_FOR_FUZZING, may alter other user-specified build option values depending on how they are set.

    fanquake commented at 11:11 am on December 5, 2025:
    Can the comment explain that?

    fanquake commented at 11:16 am on December 5, 2025:
    Also, is this meant to mark that no interaction happens after this point, or is the only place there is any interaction?

    hebasto commented at 12:14 pm on December 5, 2025:
    An explanatory comment has been added.
  15. hebasto force-pushed on Dec 5, 2025
  16. hebasto commented at 12:14 pm on December 5, 2025: member

    @sedited @fanquake

    Thank you for the review! Your feedback has been addressed.

  17. BrandonOdiwuor commented at 2:25 pm on December 21, 2025: contributor

    Tested ACK 05b92e1ffb0cfd2a388fcf05e3aaf2337c50781e

    Confirmed that dependency checks now occur after build option resolution, eliminating unnecessary scans (e.g., ZeroMQ, QRencode, QT) in specialized builds like fuzzing.

    Tested on Ubuntu 24.04 aarch64 cmake version 3.28.3

    Tested on master

    0$ cmake -B build --preset dev-mode -DBUILD_FOR_FUZZING=ON
    

    Tested on 05b92e1ffb0cfd2a388fcf05e3aaf2337c50781e

    0$ cmake -B build --preset dev-mode -DBUILD_FOR_FUZZING=ON
    
  18. DrahtBot requested review from sedited on Dec 21, 2025

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: 2026-01-07 18:13 UTC

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