cmake: Support user-defined C++ standard #31429

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:241205-standard changing 2 files +4 −2
  1. hebasto commented at 3:02 pm on December 5, 2024: member

    This PR introduces a native CMake’s way to test newer C++ standards.

    Also see: #30735.

    To configure builds with newer standards, run:

    0$ cmake -B build -DCMAKE_CXX_STANDARD=23
    1# or
    2$ cmake -B build -DCMAKE_CXX_STANDARD=26  # Requires CMake 3.25 or newer.
    
  2. hebasto added the label Build system on Dec 5, 2024
  3. cmake: Support user-defined C++ standard
    This change is useful for testing newer C++ standards.
    3a227d3d77
  4. hebasto force-pushed on Dec 5, 2024
  5. DrahtBot commented at 3:04 pm on December 5, 2024: 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/31429.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

  6. theuni commented at 4:29 pm on December 5, 2024: member

    Hmm, I see the value in this, but I don’t think we want to go as far as making this supported. Historically, anyway, we never have.

    IIRC for c++11/17/20, we made them explicit opt-ins. After adding the CMake option, users with toolchain files or env vars may accidentally end up with a 23/26 build which is not guaranteed to be in consensus. This fix comes to mind as an example of the type of bug that could be lurking.

    I realize the same could be said for CXXFLAGS, I just don’t think we should be going out of our way to support flexibility of such a core language feature that we ourselves don’t trust enough (yet) to ship.

  7. fanquake commented at 9:52 am on December 11, 2024: member
    Agree with Cory. I think what we’ve got currently is ok. We don’t need to explicitly allow poeople to compile with any other standard (accidently or not). If someone really wants to do that, they can use the same approach we do in the CI.
  8. fanquake closed this on Dec 11, 2024


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-01-06 12:12 UTC

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