# How to choose compiler (cl, clang, clang-cl) on Windows?

**URL:** https://discourse.cmake.org/t/how-to-choose-compiler-cl-clang-clang-cl-on-windows/10263
**Category:** Usage
**Tags:** os:windows
**Created:** [March 1, 2024, 7:25pm UTC](https://discourse.cmake.org/t/how-to-choose-compiler-cl-clang-clang-cl-on-windows/10263 "2024-03-01T19:25:22Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![garyo](https://discourse.cmake.org/user_avatar/discourse.cmake.org/garyo/32/4364_2.png) [@garyo](https://discourse.cmake.org/u/garyo)
#### Post date: [March 1, 2024, 7:25pm UTC](https://discourse.cmake.org/t/how-to-choose-compiler-cl-clang-clang-cl-on-windows/10263/1 "2024-03-01T19:25:22Z")

</div>

On Win11, a good way to start is to open a Developer Powershell in terminal.exe. That has all the compilers and tools in the path. Specifically it has `cl.exe`, `clang.exe`, and `clang-cl.exe`. CMake seems to pick `cl.exe` by default. Is there a way to get CMake to set up the `clang`-based tool chain instead?

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [March 2, 2024, 4:18am UTC](https://discourse.cmake.org/t/how-to-choose-compiler-cl-clang-clang-cl-on-windows/10263/2 "2024-03-02T04:18:03Z")

</div>

I is possible to select the right preset:

```auto
/Users/clausklein/Workspace/cmake/WindowsToolchain/example
Claus-iMac:example clausklein$ cmake --list-presets
Available configure presets:

  "windows-msvc-x64" - Configure for 'windows-msvc-x64'
  "windows-msvc-spectre-x64" - Configure for 'windows-msvc-spectre-x64'
  "windows-msvc-amd64" - Configure for 'windows-msvc-amd64'
  "windows-msvc-x86" - Configure for 'windows-msvc-x86'
  "windows-msvc-arm64" - Configure for 'windows-msvc-arm64'
  "windows-clang-x64" - Configure for 'windows-clang-x64'
  "windows-clang-amd64" - Configure for 'windows-clang-amd64'
  "windows-clangcl-x64" - Configure for 'windows-clangcl-x64'
  "windows-clangcl-amd64" - Configure for 'windows-clangcl-amd64'
  "ewdk" - EWDK configuration
Claus-iMac:example clausklein$ git describe --tags
v0.9.0
Claus-iMac:example clausklein$ 

```

---

<div class="post-metadata">

### Author: ![bill.hoffman](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bill.hoffman/32/13_2.png) [@bill.hoffman](https://discourse.cmake.org/u/bill.hoffman)
#### Post date: [March 4, 2024, 4:19pm UTC](https://discourse.cmake.org/t/how-to-choose-compiler-cl-clang-clang-cl-on-windows/10263/3 "2024-03-04T16:19:32Z")

</div>

Set CC and CXX env vars before running CMake to the compiler you want.
