build: explicitly disable cl.exe #36839

pull bartoli wants to merge 1 commits into bitcoin:master from bartoli:disable_cl_cmake changing 1 files +7 −0
  1. bartoli commented at 6:09 PM on November 11, 2026: none

    Since 4f1e6de6 (https://github.com/bitcoin/bitcoin/pull/31507), cmake for visual studio can only generate projects that use clang-cl. But calling cmake without '--preset windows' or '-T ClangCL' still silently generates projects that cannot build anymore.

    For example, a build with cl now fails in minisketchwrapper.c because we don't pass anymore a cl option to set __cplusplus value properly.

    I propose we explicitly tell at cmake time that this can't work anymore. If not, a lot of windows devs who use cmake without presets will lose time on this.

  2. DrahtBot added the label Build system on Nov 11, 2026
  3. DrahtBot commented at 6:10 PM on November 11, 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. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36033 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36033.svg"></sub> ([wip,nomerge,rfc] build: Require C++23 compiler by maflcko)

    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. bartoli force-pushed on Nov 11, 2026
  5. bartoli force-pushed on Nov 11, 2026
  6. in CMakeLists.txt:85 in deb118b871
      80 | @@ -81,6 +81,10 @@ if(CMAKE_VERSION VERSION_LESS 4.2 AND CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NO
      81 |  endif()
      82 |  enable_language(CXX)
      83 |  
      84 | +if(MSVC AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
      85 | +  message(FATAL_ERROR "Unsupported C++ compiler: ${CMAKE_CXX_COMPILER}. Use clang-cl.exe instead of cl.exe (use cmake option --preset windows or -T ClangCL")
    


    maflcko commented at 10:24 AM on November 12, 2026:

    could link to the build docs here, similar to how cmake/module/CheckCXXFeatures.cmake does it?


    bartoli commented at 12:14 PM on November 12, 2026:

    I updated the message to point to the doc instead of manually listing cmake options

  7. hebasto commented at 10:46 AM on November 12, 2026: member

    I'm not opposed to this change. However, I do have some concerns.

    I propose we explicitly tell at cmake time that this can't work anymore.

    There are compilers we do not support, yet none of them is explicitly banned. Banning one would make it harder for someone to experiment with it.

    FWIW, there is a nightly build that uses cl.exe.

    If not, a lot of windows devs who use cmake without presets will lose time on this.

    The documentation should help.

    Anyway, I wouldn't want to put Windows devs off merely for the reasons I stated above.

  8. maflcko commented at 10:53 AM on November 12, 2026: member

    If not, a lot of windows devs who use cmake without presets will lose time on this.

    The documentation should help.

    In theory, it could be a warning that the compiler is not supported (link to docs) and should only be used at their own risk? However, I am not sure if someone not reading the docs to start will read the warning.

  9. bartoli commented at 11:37 AM on November 12, 2026: none

    If not, a lot of windows devs who use cmake without presets will lose time on this.

    The documentation should help.

    In theory, it could be a warning that the compiler is not supported (link to docs) and should only be used at their own risk? However, I am not sure if someone not reading the docs to start will read the warning.

    Well, i was not thinking about someone setting up a new build environement; that person should read the doc indeed. But about the devs that already have a custom build env, and will not read the doc at each pull

    FWIW, there is a nightly build that uses cl.exe.

    It seems they added patches to workaround the change in the main repo : https://github.com/hebasto/bitcoin-core-nightly/commit/727b9af3e2eb0bffb468e62b217c2f5296bd1690

  10. bartoli force-pushed on Nov 12, 2026
  11. build: explicitly disable cl.exe
    Since 4f1e6de6, cmake for visual studio can only generate projects that
    use clang-cl.
    But calling cmake without '--preset windows' or '-T ClangCL' still
    silently generates projects that cannot build anymore.
    
    Explicitly print a fatal error at cmake time if cl.exe is selected and
    point to the doc.
    eca1492f59
  12. in CMakeLists.txt:87 in 1d28a5bd48
      80 | @@ -81,6 +81,12 @@ if(CMAKE_VERSION VERSION_LESS 4.2 AND CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NO
      81 |  endif()
      82 |  enable_language(CXX)
      83 |  
      84 | +if(MSVC AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
      85 | +  message(FATAL_ERROR
      86 | +  "Unsupported C++ compiler: ${CMAKE_CXX_COMPILER}.\n"
      87 | +  "See doc/build-windows-native.md#building")
    


    maflcko commented at 12:33 PM on November 12, 2026:
      "See the recommended doc/build-windows-native.md#building or remove this check and continue at your own risk without support.")
    

    nit: I guess this option is obvious, but it could make sense to spell it out, given that some do that experimentally. But no strong opinion.


    bartoli commented at 12:55 PM on November 12, 2026:

    That makes sense, thanks

  13. bartoli force-pushed on Nov 12, 2026
  14. DrahtBot added the label CI failed on Nov 12, 2026
  15. DrahtBot removed the label CI failed on Nov 12, 2026

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-16 00:51 UTC

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