Skip to content

Commit 4ab3490

Browse files
ivan444fmeum
authored andcommitted
Fix the docs for using Clang on Windows
Closes bazelbuild#26002 Remove the step that's changing the MODULE.bazel file. It no longer works (Bazel errors out) and it's not needed (Bazel with Clang works without it). Closes bazelbuild#26003. PiperOrigin-RevId: 759995454 Change-Id: I7a4ccb6dce215516433c4a6a9aaf9e62f5f68326
1 parent 54c6ea8 commit 4ab3490

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

site/en/configure/windows.md

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,8 @@ Bazel where LLVM is installed by `BAZEL_LLVM`.
244244
245245
To enable the Clang toolchain for building C++, there are several situations.
246246
247-
* In bazel 0.28 and older: Clang is not supported.
248-
249-
* Without `--incompatible_enable_cc_toolchain_resolution`:
250-
You can enable the Clang toolchain by a build flag `--compiler=clang-cl`.
251-
252-
* With `--incompatible_enable_cc_toolchain_resolution`:
253-
You have to add a platform target to your `BUILD file` (eg. the top level `BUILD` file):
247+
* In Bazel 7.0.0 and newer: Add a platform target to your `BUILD file` (eg. the
248+
top level `BUILD` file):
254249
255250
```
256251
platform(
@@ -263,28 +258,21 @@ To enable the Clang toolchain for building C++, there are several situations.
263258
)
264259
```
265260
266-
Then you can enable the Clang toolchain by either of the following two ways:
267-
* Specify the following build flags:
261+
Then enable the Clang toolchain by specifying the following build flags:
268262
269263
```
270264
--extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl --extra_execution_platforms=//:x64_windows-clang-cl
271265
```
272266
273-
* Register the platform and toolchain in your `MODULE.bazel` file:
267+
* In Bazel older than 7.0.0 but newer than 0.28: Enable the Clang toolchain by
268+
a build flag `--compiler=clang-cl`.
274269
275-
```
276-
register_execution_platforms(
277-
":x64_windows-clang-cl"
278-
)
279-
280-
register_toolchains(
281-
"@local_config_cc//:cc-toolchain-x64_windows-clang-cl",
282-
)
283-
```
270+
If your build sets the flag
271+
[\-\-incompatible_enable_cc_toolchain_resolution]
272+
(https://github.com/bazelbuild/bazel/issues/7260){: .external}
273+
to `true`, then use the approach for Bazel 7.0.0.
284274
285-
The [\-\-incompatible_enable_cc_toolchain_resolution](https://github.com/bazelbuild/bazel/issues/7260){: .external}
286-
flag is planned to be enabled by default in future Bazel release. Therefore,
287-
it is recommended to enable Clang support with the second approach.
275+
* In Bazel 0.28 and older: Clang is not supported.
288276
289277
### Build Java {:#java}
290278

0 commit comments

Comments
 (0)