@@ -244,13 +244,8 @@ Bazel where LLVM is installed by `BAZEL_LLVM`.
244
244
245
245
To enable the Clang toolchain for building C++, there are several situations.
246
246
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):
254
249
255
250
```
256
251
platform(
@@ -263,28 +258,21 @@ To enable the Clang toolchain for building C++, there are several situations.
263
258
)
264
259
```
265
260
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:
268
262
269
263
```
270
264
--extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl --extra_execution_platforms=//:x64_windows-clang-cl
271
265
```
272
266
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`.
274
269
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.
284
274
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.
288
276
289
277
### Build Java {:#java}
290
278
0 commit comments