cmake: Switch `include_directories` -> `target_include_directories` #36889

pull hebasto wants to merge 3 commits into bitcoin:master from hebasto:261116-non-target-directive changing 3 files +5 −40
  1. hebasto commented at 2:00 PM on November 16, 2026: member

    Use of non-target directives is not recommended. As of CMake 4.5.0, such use triggers -Wnon-target-directive warnings:

    $ cmake -B build -Wnon-target-directive
    <snip>
    CMake Warning (non-target-directive) at src/CMakeLists.txt:8 (include_directories):
      Use of non-target directives is not recommended.  Consider
      target_include_directories instead.
    This warning is for project developers.  Use -Wno-author or
    -Wno-non-target-directive to suppress it.
    
    <snip>
    

    This PR:

    1. Links bitcoin_ipc against core_interface, so that ipc/stub.cpp is compiled with the project-wide build flags.

    2. Replaces the include_directories() call in src/CMakeLists.txt with target_include_directories().

    3. Removes the custom WarnAboutGlobalProperties module, which is superseded by the new CMake warning.


    The counterpart for the secp256k1 repo is https://github.com/bitcoin-core/secp256k1/pull/1996.

  2. hebasto added the label Build system on Nov 16, 2026
  3. DrahtBot commented at 2:00 PM on November 16, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK fanquake

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. hebasto marked this as a draft on Nov 16, 2026
  5. cmake: Link `bitcoin_ipc` against `core_interface`
    Otherwise, `ipc/stub.cpp` is compiled without the project-wide
    build flags.
    4ef05d6f45
  6. cmake: Switch `include_directories` -> `target_include_directories`
    Use of non-target directives is not recommended. As of CMake 4.5.0, it
    triggers `-Wnon-target-directive` warnings.
    460f877fac
  7. hebasto force-pushed on Nov 16, 2026
  8. DrahtBot added the label CI failed on Nov 16, 2026
  9. hebasto marked this as ready for review on Nov 16, 2026
  10. DrahtBot removed the label CI failed on Nov 16, 2026
  11. fanquake commented at 10:41 AM on November 17, 2026: member

    Our custom check does not cover the src/ subdirectory.

    Can you elaborate? Does this mean it wasn't working properly?

    Once one of the CI jobs runs CMake >=4.5.0, that custom check can be removed.

    brew is already shipping CMake 4.5.0, so it should be in the CI any time from now, and I'd assume most macOS devs are already using it. So this could just be dropped now?

  12. fanquake added this to the milestone 33.0 on Nov 17, 2026
  13. fanquake added the label Needs backport (30.x) on Nov 17, 2026
  14. fanquake added the label Needs Backport (31.x) on Nov 17, 2026
  15. fanquake added the label Needs Backport (32.x) on Nov 17, 2026
  16. hebasto commented at 11:19 AM on November 17, 2026: member

    Our custom check does not cover the src/ subdirectory.

    Can you elaborate? Does this mean it wasn't working properly?

    It checks the properties of the current directory, which is the repo’s root. If I recall correctly, that was considered sufficient when the check was introduced, as all global compiler and linker flags are set there. The include_directories() call fixed in this PR is the only case it missed.

  17. cmake: Remove `WarnAboutGlobalProperties` module
    The module is superseded by CMake's `-Wnon-target-directive` warnings,
    which are enabled when using the "dev-mode" preset.
    435d5b2277
  18. hebasto commented at 11:35 AM on November 17, 2026: member

    Once one of the CI jobs runs CMake >=4.5.0, that custom check can be removed.

    brew is already shipping CMake 4.5.0, so it should be in the CI any time from now, and I'd assume most macOS devs are already using it. So this could just be dropped now?

    Sure. Dropped.

  19. fanquake commented at 3:51 PM on November 18, 2026: member

    ACK 435d5b227748a0ac5d6d2887050acf02304576f2 - going to merge this now, given it was mentioned on IRC that devs are seeing local build breakage (after updating CMake).

  20. fanquake merged this on Nov 18, 2026
  21. fanquake closed this on Nov 18, 2026

  22. hebasto deleted the branch on Nov 18, 2026
  23. fanquake commented at 4:07 PM on November 18, 2026: member

    Backported to 32.x in #36727.

  24. fanquake removed the label Needs Backport (32.x) on Nov 18, 2026
  25. fanquake referenced this in commit 1d3b33204d on Nov 18, 2026
  26. fanquake referenced this in commit 60850405ab on Nov 18, 2026
  27. fanquake referenced this in commit fe20697eab on Nov 18, 2026
  28. fanquake referenced this in commit c4547c490f on Nov 18, 2026
  29. fanquake referenced this in commit 1a385857e1 on Nov 18, 2026
  30. fanquake removed the label Needs Backport (31.x) on Nov 18, 2026
  31. fanquake commented at 4:13 PM on November 18, 2026: member

    Backported to 31.x in #36901.

  32. fanquake referenced this in commit 6c55420edb on Nov 18, 2026
  33. fanquake referenced this in commit bf137ff02a on Nov 18, 2026
  34. fanquake referenced this in commit 31bd06b27f on Nov 18, 2026
  35. fanquake referenced this in commit 52824e540c on Nov 18, 2026
  36. fanquake referenced this in commit 1e69d11778 on Nov 18, 2026
  37. fanquake removed the label Needs backport (30.x) on Nov 18, 2026
  38. fanquake commented at 4:39 PM on November 18, 2026: member

    Backported to 30.x in #36902.


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-11-19 19:51 UTC

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