Skip to content

Commit 4c66544

Browse files
authored
Merge pull request #4176 from walbourn/patch-1
Update clang-support-msbuild.md
2 parents c622bc6 + b75ca1e commit 4c66544

File tree

1 file changed

+13
-35
lines changed

1 file changed

+13
-35
lines changed

docs/build/clang-support-msbuild.md

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
---
22
description: "Learn more about: Clang/LLVM support in Visual Studio projects"
33
title: "Clang/LLVM support in Visual Studio projects"
4-
ms.date: 06/29/2022
4+
ms.date: 09/20/2022
55
ms.description: "Configure a Visual Studio MSBuild project to use the Clang/LLVM toolchain."
66
helpviewer_keywords: ["Clang support for C++ MSBuild projects"]
77
---
88
# Clang/LLVM support in Visual Studio projects
99

1010
::: moniker range="<=msvc-150"
1111

12-
Clang support for both CMake and MSBuild projects is available in Visual Studio 2019.
12+
Clang/LLVM support for both CMake and MSBuild projects is available in Visual Studio 2019 and Visual Studio 2022.
1313

1414
::: moniker-end
1515

1616
::: moniker range=">=msvc-160"
1717

18-
You can use Visual Studio 2019 version 16.2 and later with Clang to edit, build, and debug C++ Visual Studio projects (MSBuild) that target Windows or Linux.
18+
You can use Visual Studio 2019 version 16.2 and later with Clang/LLVM to edit, build, and debug C++ Visual Studio projects (MSBuild) that target Windows or Linux.
1919

2020
## Install
2121

22-
For best IDE support in Visual Studio, we recommend using the latest Clang compiler tools for Windows. If you don't already have the tools, you can install them by opening the Visual Studio Installer and choosing **C++ Clang tools for Windows** under **Desktop development with C++** optional components. You may prefer to use an existing Clang installation on your machine; if so, choose **C++ Clang-cl for v142 build tools**.
22+
For best IDE support in Visual Studio, we recommend using the latest Clang compiler tools for Windows. If you don't already have the tools, you can install them by opening the Visual Studio Installer and choosing **C++ Clang tools for Windows** under **Desktop development with C++** optional components. You may prefer to use an existing Clang installation on your machine; if so, choose **C++ Clang-cl for v142 build tools** or **C++ Clang-cl for v143 build tools**.
2323

2424
The Microsoft C++ Standard Library requires at least Clang 8.0.0.
2525

2626
![Screenshot of the Visual Studio installer with the Individual components tab selected and the C plus plus Clang components visible.](media/clang-install-vs2019.png)
2727

28-
Later versions of Visual Studio provide newer versions of the Clang toolset. The bundled version of Clang gets updated automatically to stay current with updates in the Microsoft implementation of the Standard Library. For example, Visual Studio 2019 version 16.9 includes Clang v11.
28+
Later versions of Visual Studio provide newer versions of the Clang toolset. The bundled version of Clang gets updated automatically to stay current with updates in the Microsoft implementation of the Standard Library. For example, Visual Studio 2019 version 16.11 includes Clang v12.
2929

3030
## Configure a Windows project to use Clang tools
3131

@@ -52,58 +52,36 @@ To configure a Visual Studio Linux project to use Clang:
5252

5353
On Linux, Visual Studio by default uses the first Clang location that it finds in the PATH environment property. If you're using a custom Clang installation, then either change the value of the `LLVMInstallDir` property or else enter the path under **Project** > **Properties** > **Configuration Properties** > **VC++ DIrectories** > **Executable Directories**. For more information, see [Set a custom LLVM location](#custom_llvm_location).
5454

55-
## <a name="custom_llvm_location"></a> Set a custom LLVM location
55+
## <a name="custom_llvm_location"></a> Set a custom LLVM location and toolset
5656

57-
You can set a custom path to LLVM for one or more projects by creating a *Directory.build.props* file. Then, add that file to the root folder of any project. You can add it to the root solution folder to apply it to all projects in the solution. The file should look like this (but use your actual LLVM path):
57+
To set a custom path to LLVM and set a custom LLVM toolset version for one or more projects, create a *Directory.build.props* file. Then, add that file to the root folder of any project. You can add it to the root solution folder to apply it to all projects in the solution. The file should look like this example (but use your actual LLVM path and version number):
5858

5959
```xml
6060
<Project>
6161
<PropertyGroup>
6262
<LLVMInstallDir>C:\MyLLVMRootDir</LLVMInstallDir>
63+
<LLVMToolsVersion>15.0.0</LLVMToolsVersion>
6364
</PropertyGroup>
6465
</Project>
6566
```
6667

67-
You can combine this property with a custom LLVM toolset version. For more information, see [Set a custom LLVM toolset version](#custom_llvm_toolset).
68+
## <a name="custom_llvm_toolset"></a> Set a custom LLVM toolset version in the IDE
6869

69-
## <a name="custom_llvm_toolset"></a> Set a custom LLVM toolset version
70+
Starting in Visual Studio 2019 version 16.9, you can set a custom toolset version for LLVM in Visual Studio. To set this property in a project:
7071

71-
Starting in Visual Studio 2019 version 16.9, you can set a custom toolset version for LLVM. To set this property in a project in Visual Studio:
72-
73-
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](./working-with-project-properties.md).
72+
1. Open the project's **Property Pages** dialog box. For more information, see [Set C++ compiler and build properties](./working-with-project-properties.md).
7473

7574
1. Select the **Configuration Properties** > **General** property page.
7675

77-
1. Modify the **Platform Toolset** property to *LLVM (clang-cl)*, if it isn't already set.
76+
1. Modify the **Platform Toolset** property to *LLVM (clang-cl)*, if it isn't already set. Choose **Apply** to save your changes.
7877

7978
1. Select the **Configuration Properties** > **Advanced** property page.
8079

8180
1. Modify the **LLVM Toolset Version** property to your preferred version, and then choose **OK** to save your changes.
8281

8382
The **LLVM Toolset Version** property only appears when the LLVM platform toolset is selected.
8483

85-
You can set the toolset version for one or more projects by creating a *Directory.build.props* file. Then, add that file to the root folder of any project. Add it to the root solution folder to apply it to all projects in the solution. The file should look like this (but use your actual LLVM path):
86-
87-
```xml
88-
<Project>
89-
<PropertyGroup>
90-
<LLVMToolsVersion>11.0.0</LLVMToolsVersion>
91-
</PropertyGroup>
92-
</Project>
93-
```
94-
95-
You can also combine this property with a custom LLVM location. For example, your *Directory.build.props* file could look like:
96-
97-
```xml
98-
<Project>
99-
<PropertyGroup>
100-
<LLVMInstallDir>C:\MyLLVMRootDir</LLVMInstallDir>
101-
<LLVMToolsVersion>11.0.0</LLVMToolsVersion>
102-
</PropertyGroup>
103-
</Project>
104-
```
105-
106-
When you add a *Directory.build.props* file, the settings appear as the default in the project Property Pages dialog. However, changes to these properties in Visual Studio override the settings in the *Directory.build.props* file.
84+
When you add a *Directory.build.props* file to a project or solution, the settings appear as the default in the project Property Pages dialog. However, changes to these properties in Visual Studio override the settings in the *Directory.build.props* file.
10785

10886
## Set additional properties, edit, build, and debug
10987

0 commit comments

Comments
 (0)