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 +95 −79
  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:

    $ cmake -B build --preset dev-mode -DBUILD_FOR_FUZZING=ON
    <snip>
    -- Found PkgConfig: /usr/bin/pkg-config (found version "2.3.0")
    -- Found ZeroMQ: /usr/lib64 (found suitable version "4.3.5", minimum required is "4.0.0")
    -- Performing Test HAVE_USDT_H
    -- Performing Test HAVE_USDT_H - Success
    -- Found USDT: /usr/include
    -- Found QRencode: /usr/lib64/libqrencode.so (found version "4.1.1")
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
    -- Found Threads: TRUE
    -- Performing Test HAVE_STDATOMIC
    -- Performing Test HAVE_STDATOMIC - Success
    -- Found WrapAtomic: TRUE
    -- Found OpenGL: /usr/lib64/libOpenGL.so
    -- Found WrapOpenGL: TRUE
    -- Found WrapVulkanHeaders: /usr/include
    -- Found Qt: /usr/lib64/cmake/Qt6 (found suitable version "6.10.1", minimum required is "6.2")
    CMake Warning at CMakeLists.txt:206 (message):
      BUILD_FOR_FUZZING=ON will disable all other targets and force
      BUILD_FUZZ_BINARY=ON.
    
    <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

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK sedited
    Stale ACK BrandonOdiwuor

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #bitcoin-core/gui/933 ([DRAFT] Introduce Qt test automation bridge and gui functional tests by johnny9)
    • #35118 (fuzz: add ipc round-trip fuzz target by enirox001)
    • #35098 (guix: Compile GUI separately from other binaries by hebasto)
    • #35072 (cmake: Remove GUI-specific definitions from bitcoin-build-config.h by hebasto)
    • #34580 (build: Add a compiler minimum version check by polespinasa)
    • #32387 (ipc: add windows support by ryanofsky)
    • #32367 (cmake: Check user-defined APPEND_*FLAGS variables early by hebasto)
    • #31723 (qa: Facilitate debugging bitcoind inside functional tests by hodlinator)
    • #31425 (RFC: Riscv bare metal CI job by sedited)

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  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:

    5bd1a78f590d48e5ceb5815b5ed346d06d738871c9ea26b754c9a851dcb7ee85  guix-build-56d0a0929d89/output/aarch64-linux-gnu/SHA256SUMS.part
    cc0525310c1e1c1b1cb69c2256b8089b187830c27da9dd7ba9830884c35a0e95  guix-build-56d0a0929d89/output/aarch64-linux-gnu/bitcoin-56d0a0929d89-aarch64-linux-gnu-debug.tar.gz
    bc891ef995772a5f09c48000b0b0e7d6dc142ae184490ef711c800f42c48cdeb  guix-build-56d0a0929d89/output/aarch64-linux-gnu/bitcoin-56d0a0929d89-aarch64-linux-gnu.tar.gz
    c1da46ecfaec3c3e040a6504182faf5f114cdbb69926757b1b10192e11919c2c  guix-build-56d0a0929d89/output/arm-linux-gnueabihf/SHA256SUMS.part
    5d5e6287f0369f662526d3af08041e7544bed163c41421d8c81be97b522d0c89  guix-build-56d0a0929d89/output/arm-linux-gnueabihf/bitcoin-56d0a0929d89-arm-linux-gnueabihf-debug.tar.gz
    b4752c479a4a26930d00eb7b775f70744d73a6adbb06ea6d1f5a9542841ab994  guix-build-56d0a0929d89/output/arm-linux-gnueabihf/bitcoin-56d0a0929d89-arm-linux-gnueabihf.tar.gz
    f73e98957bad390793b82c9d0d60d1733723e57335bcd2535d942e3931297219  guix-build-56d0a0929d89/output/arm64-apple-darwin/SHA256SUMS.part
    a82dea7564ffa2fe233d758778315aebcb1d9df4f0e5c637d2068512c5a8377a  guix-build-56d0a0929d89/output/arm64-apple-darwin/bitcoin-56d0a0929d89-arm64-apple-darwin-codesigning.tar.gz
    f1efcb20c5c4316b54b29b3cbb7b13346df2429d21cb80cf539397b879ce490e  guix-build-56d0a0929d89/output/arm64-apple-darwin/bitcoin-56d0a0929d89-arm64-apple-darwin-unsigned.tar.gz
    4fb3b6f31c33b06cfa209235efa45129b4fc0b6914614f9760d697563d62e286  guix-build-56d0a0929d89/output/arm64-apple-darwin/bitcoin-56d0a0929d89-arm64-apple-darwin-unsigned.zip
    f0403ed60ea3aa384c072fb669e42991336a1b0e55e469e31832a56ee39d77a3  guix-build-56d0a0929d89/output/dist-archive/bitcoin-56d0a0929d89.tar.gz
    3a14924b8009db324534962b571987a5cc739e79206193bddf486af4d4b1d311  guix-build-56d0a0929d89/output/powerpc64-linux-gnu/SHA256SUMS.part
    14015dd634a12d7280f1a6566ee751985b94b6fc2977dcd145d1e3e7a19becd5  guix-build-56d0a0929d89/output/powerpc64-linux-gnu/bitcoin-56d0a0929d89-powerpc64-linux-gnu-debug.tar.gz
    b20eab5ad318339ef0ef68246780836a3ea0a50a9d7f9ff321082bffcbe628b8  guix-build-56d0a0929d89/output/powerpc64-linux-gnu/bitcoin-56d0a0929d89-powerpc64-linux-gnu.tar.gz
    3c95edab2bf41192162392cd5fac69973974cbba4098e79da26abdc26ddf2a02  guix-build-56d0a0929d89/output/riscv64-linux-gnu/SHA256SUMS.part
    5897b2f595df0121e12075373343d6244375fb54067af692d6ed220b6925fcba  guix-build-56d0a0929d89/output/riscv64-linux-gnu/bitcoin-56d0a0929d89-riscv64-linux-gnu-debug.tar.gz
    9494532acad032a435b4cc0c6b0c2faef8e333a7b561515d236ed98acafff038  guix-build-56d0a0929d89/output/riscv64-linux-gnu/bitcoin-56d0a0929d89-riscv64-linux-gnu.tar.gz
    58f758b7db06e5f76457f366b86a16b6d4994274c8dfedd3f6a4bb7c8938bc02  guix-build-56d0a0929d89/output/x86_64-apple-darwin/SHA256SUMS.part
    8720f905960ba7fc7e7625614236b587176380bb0b33cbe2c3ccc28ea1af7929  guix-build-56d0a0929d89/output/x86_64-apple-darwin/bitcoin-56d0a0929d89-x86_64-apple-darwin-codesigning.tar.gz
    655b68f2ae7ef9cf4f54be47cda3fec98aa8b086bd616921a61904109da15108  guix-build-56d0a0929d89/output/x86_64-apple-darwin/bitcoin-56d0a0929d89-x86_64-apple-darwin-unsigned.tar.gz
    5020c9f35a2584cb7fcf210815b53f509b8da624ffe7ce953b22f1bfe0510d2a  guix-build-56d0a0929d89/output/x86_64-apple-darwin/bitcoin-56d0a0929d89-x86_64-apple-darwin-unsigned.zip
    05fda737070cc821214064a2d5ef9bc15fc0b6b76d2df3b2b64c52d8c309c115  guix-build-56d0a0929d89/output/x86_64-linux-gnu/SHA256SUMS.part
    a23759a540eb48c6695b0583fe30fbc994f9a89b70de996499e7304bd24e9b59  guix-build-56d0a0929d89/output/x86_64-linux-gnu/bitcoin-56d0a0929d89-x86_64-linux-gnu-debug.tar.gz
    1de1e23e698a6f23b9e69c96e65237f2a26a77d3da19b6fefe9386d7ada7f076  guix-build-56d0a0929d89/output/x86_64-linux-gnu/bitcoin-56d0a0929d89-x86_64-linux-gnu.tar.gz
    df33c8b9e987fbeb0aa2fbfada49b24c596b63a4a9f6c6daf56168ade90bfb14  guix-build-56d0a0929d89/output/x86_64-w64-mingw32/SHA256SUMS.part
    90fdb394150627d7dd85c407d56ae6a50cc7fb4e64ab95d916523515b4879724  guix-build-56d0a0929d89/output/x86_64-w64-mingw32/bitcoin-56d0a0929d89-win64-codesigning.tar.gz
    b5d3df18b6f6de5809da5fdec697f2e4fcbc8b4635331d4214507b4c40b837a0  guix-build-56d0a0929d89/output/x86_64-w64-mingw32/bitcoin-56d0a0929d89-win64-debug.zip
    3902aa61740e4f74d4aa39b64849a1234c3bf28524298c382c4db556e1b5977f  guix-build-56d0a0929d89/output/x86_64-w64-mingw32/bitcoin-56d0a0929d89-win64-setup-unsigned.exe
    eb3bccca9af379f2cee04fbe42c0441988ff558c514c04d9d7fa003f325a13ac  guix-build-56d0a0929d89/output/x86_64-w64-mingw32/bitcoin-56d0a0929d89-win64-unsigned.zip
    
  13. 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.

  14. hebasto force-pushed on Dec 5, 2025
  15. hebasto commented at 12:14 PM on December 5, 2025: member

    @sedited @fanquake

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

  16. 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

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

    <img width="958" height="909" alt="Screenshot 2025-12-21 at 17 09 38" src="https://github.com/user-attachments/assets/e1ef4fde-50d7-4cb6-a76c-40611206fbe7" />

    Tested on 05b92e1ffb0cfd2a388fcf05e3aaf2337c50781e

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

    <img width="949" height="917" alt="Screenshot 2025-12-21 at 17 10 23" src="https://github.com/user-attachments/assets/d4dee9ae-7609-40de-8973-38f28ed4e2e9" />

  17. DrahtBot requested review from sedited on Dec 21, 2025
  18. sedited approved
  19. sedited commented at 1:24 PM on January 25, 2026: contributor

    Re-ACK 05b92e1ffb0cfd2a388fcf05e3aaf2337c50781e

  20. DrahtBot added the label Needs rebase on Feb 5, 2026
  21. hebasto force-pushed on Feb 14, 2026
  22. hebasto commented at 10:12 PM on February 14, 2026: member

    Rebased to resolve conflicts.

  23. DrahtBot removed the label Needs rebase on Feb 15, 2026
  24. hebasto commented at 9:18 AM on February 15, 2026: member

    My Guix build:

    aarch64
    24ac0893e16e7e8a1a0300c86c335c79a548a67b75835e794e53fbbf631e37d3  guix-build-00fc68fa0aa5/output/aarch64-linux-gnu/SHA256SUMS.part
    61ad90ac626226b0fa16a1b57dd05f3c3984369b1d83c68d96da1556bcee6a8d  guix-build-00fc68fa0aa5/output/aarch64-linux-gnu/bitcoin-00fc68fa0aa5-aarch64-linux-gnu-debug.tar.gz
    7aba7cec5d0e5f9fac539c4ccbfcab53cdc5b024fb71ac76c4646a3dacfd4aba  guix-build-00fc68fa0aa5/output/aarch64-linux-gnu/bitcoin-00fc68fa0aa5-aarch64-linux-gnu.tar.gz
    e0d9ab3d8184953ae2c3a77739c92e78ffcf3205f48be05874e6562edc5d8467  guix-build-00fc68fa0aa5/output/arm-linux-gnueabihf/SHA256SUMS.part
    55c2450a08e99f04aa8c49fbaadc75b186c61a3ed1b84f79c1079db4e4a822f2  guix-build-00fc68fa0aa5/output/arm-linux-gnueabihf/bitcoin-00fc68fa0aa5-arm-linux-gnueabihf-debug.tar.gz
    d5e5468a05329f9f9d8f6d4a7785c2e3f47de272c4d7855a348c2e7553986345  guix-build-00fc68fa0aa5/output/arm-linux-gnueabihf/bitcoin-00fc68fa0aa5-arm-linux-gnueabihf.tar.gz
    cfe3deb18e02021fbeed156929ae8b4dedb8c011cc4bbe71bdb01ca5074840aa  guix-build-00fc68fa0aa5/output/arm64-apple-darwin/SHA256SUMS.part
    ecf3c55a606620386a9b6fb5625148007b9e63aaa52da204e7d608e4e6f1825b  guix-build-00fc68fa0aa5/output/arm64-apple-darwin/bitcoin-00fc68fa0aa5-arm64-apple-darwin-codesigning.tar.gz
    1a48b33530473a156571a47e5047381530f61810ecc9625b784e751028f6ad6b  guix-build-00fc68fa0aa5/output/arm64-apple-darwin/bitcoin-00fc68fa0aa5-arm64-apple-darwin-unsigned.tar.gz
    7344c91c0b0867ba8fa42321041b69b9fc791b085d697fb831845a735d7e74bc  guix-build-00fc68fa0aa5/output/arm64-apple-darwin/bitcoin-00fc68fa0aa5-arm64-apple-darwin-unsigned.zip
    5d1d6755dc080661556556bcc005fe14559661934994cbf4763bd9f16ce02d31  guix-build-00fc68fa0aa5/output/dist-archive/bitcoin-00fc68fa0aa5.tar.gz
    832e5f53eb8132f91470cc71d1543a42c44ef73476d4e8eaa319f4f3221a5065  guix-build-00fc68fa0aa5/output/powerpc64-linux-gnu/SHA256SUMS.part
    a90c345cab8218658ed64d139fc91bd971a6a16e943394a6eee89d2d04f2278b  guix-build-00fc68fa0aa5/output/powerpc64-linux-gnu/bitcoin-00fc68fa0aa5-powerpc64-linux-gnu-debug.tar.gz
    092ebe9a6d075d4e3901232dc6bac235b147ee3762b61ef3b25ce3014abd4b05  guix-build-00fc68fa0aa5/output/powerpc64-linux-gnu/bitcoin-00fc68fa0aa5-powerpc64-linux-gnu.tar.gz
    f594fd95a5c56742f9a0aac9669a8a7b7c2638967257c8ade96d42c2afde6cbd  guix-build-00fc68fa0aa5/output/riscv64-linux-gnu/SHA256SUMS.part
    62c6fb8192632d12da5aadb1c49a0068931d873d71bcf92d5c570032eb35df52  guix-build-00fc68fa0aa5/output/riscv64-linux-gnu/bitcoin-00fc68fa0aa5-riscv64-linux-gnu-debug.tar.gz
    a33bad6d80e585c5a2f5100b40c151ed3458b38a601bd56f760b22353a95a614  guix-build-00fc68fa0aa5/output/riscv64-linux-gnu/bitcoin-00fc68fa0aa5-riscv64-linux-gnu.tar.gz
    7831630e9afa008b59092fcd3eb6ae1eda4b9b3bc92ee07eed3180c9b5897bda  guix-build-00fc68fa0aa5/output/x86_64-apple-darwin/SHA256SUMS.part
    a2429e27d81a19ce3525f9453785f89e586f99f1fb6425d2fd76c1aa2ceee44d  guix-build-00fc68fa0aa5/output/x86_64-apple-darwin/bitcoin-00fc68fa0aa5-x86_64-apple-darwin-codesigning.tar.gz
    d19d4d60f1a4b414d5f0131562857e314ff475fc14945b190e750441581cce8a  guix-build-00fc68fa0aa5/output/x86_64-apple-darwin/bitcoin-00fc68fa0aa5-x86_64-apple-darwin-unsigned.tar.gz
    ecd856595f2fb9720502da5186a0cf7c78a2c10110d6af4e3f7483c37a924a79  guix-build-00fc68fa0aa5/output/x86_64-apple-darwin/bitcoin-00fc68fa0aa5-x86_64-apple-darwin-unsigned.zip
    a37d5582f074684178f570decd795a0c4b14732d11e154c942b0f5f9db6a1fe9  guix-build-00fc68fa0aa5/output/x86_64-linux-gnu/SHA256SUMS.part
    515fb95ff95f9dc99687e8ce568197d4bdbf7214d0d666597a6b58f03e0916fc  guix-build-00fc68fa0aa5/output/x86_64-linux-gnu/bitcoin-00fc68fa0aa5-x86_64-linux-gnu-debug.tar.gz
    9386eb06ac8892cc0f0317a990352024dd99757c156ab675e529a45cca508f55  guix-build-00fc68fa0aa5/output/x86_64-linux-gnu/bitcoin-00fc68fa0aa5-x86_64-linux-gnu.tar.gz
    ad1a314b700192da81ced14cd7fd173e4158f860cecb76959b90b26b323da171  guix-build-00fc68fa0aa5/output/x86_64-w64-mingw32/SHA256SUMS.part
    8b72f09497fc4389cb2f6d14d163aa561e5f5dfe9d7950df8be620761c53b22b  guix-build-00fc68fa0aa5/output/x86_64-w64-mingw32/bitcoin-00fc68fa0aa5-win64-codesigning.tar.gz
    f534a4c8acdf1d90acbc55184254c19e32fd32a446eeed0e697d4480a78890a2  guix-build-00fc68fa0aa5/output/x86_64-w64-mingw32/bitcoin-00fc68fa0aa5-win64-debug.zip
    44311fc0d042462a3d099468c54a083526edfcafff4e5cc8a1d9a905714fdf49  guix-build-00fc68fa0aa5/output/x86_64-w64-mingw32/bitcoin-00fc68fa0aa5-win64-setup-unsigned.exe
    3d2c1e4a53cec5dec1836815ede9555d42da379321a1812ce5d338dda5b8ecbb  guix-build-00fc68fa0aa5/output/x86_64-w64-mingw32/bitcoin-00fc68fa0aa5-win64-unsigned.zip
    
  25. DrahtBot added the label Needs rebase on Feb 19, 2026
  26. hebasto force-pushed on Feb 19, 2026
  27. hebasto commented at 3:07 PM on February 19, 2026: member

    Rebased due to a conflict with merged bitcoin/bitcoin#28792.

  28. DrahtBot removed the label Needs rebase on Feb 19, 2026
  29. hebasto force-pushed on Feb 20, 2026
  30. hebasto commented at 7:20 PM on February 20, 2026: member

    Rebased due to a conflict with merged bitcoin/bitcoin#34605.

  31. DrahtBot added the label CI failed on Feb 20, 2026
  32. hebasto marked this as a draft on Feb 20, 2026
  33. hebasto marked this as ready for review on Feb 20, 2026
  34. DrahtBot removed the label CI failed on Feb 24, 2026
  35. sedited approved
  36. sedited commented at 9:13 PM on March 4, 2026: contributor

    Re-ACK e8142cf0caaef5df04d96cc31da70aa46ced6b7a

  37. DrahtBot requested review from BrandonOdiwuor on Mar 4, 2026
  38. DrahtBot added the label Needs rebase on Mar 19, 2026
  39. cmake: Check dependencies after build option interaction dd7e1bd87d
  40. hebasto force-pushed on Mar 20, 2026
  41. hebasto commented at 8:50 PM on March 20, 2026: member

    Rebased to resolve a conflict with the merged bitcoin/bitcoin#34848.

  42. sedited approved
  43. sedited commented at 9:09 PM on March 20, 2026: contributor

    Re-ACK dd7e1bd87dba2e9031b248b66cb2f7eb29a546ca

  44. DrahtBot removed the label Needs rebase on Mar 20, 2026
  45. in .github/ci-windows.py:37 in dd7e1bd87d
      33 | @@ -34,8 +34,6 @@ def run(cmd, **kwargs):
      34 |      "fuzz": [
      35 |          "-DVCPKG_MANIFEST_NO_DEFAULT_FEATURES=ON",
      36 |          "-DVCPKG_MANIFEST_FEATURES=wallet",
      37 | -        "-DBUILD_GUI=OFF",
    


    fanquake commented at 12:51 AM on March 23, 2026:

    hebasto commented at 2:12 PM on March 23, 2026:

    This PR removes -DBUILD_GUI=OFF and -DWITH_ZMQ=OFF from the "fuzz" CI job due to the fixed interaction with -DBUILD_FOR_FUZZING=ON.

    The documentation section you mentioned remains accurate, as it doesn't involve the BUILD_FOR_FUZZING option.


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-04-24 21:12 UTC

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