Skip to content

Commit 27c2eb0

Browse files
Learn Build Service GitHub AppLearn Build Service GitHub App
authored andcommitted
Merging changes synced from https://github.com/MicrosoftDocs/cpp-docs-pr (branch live)
2 parents 52837ef + e11008a commit 27c2eb0

18 files changed

+154
-147
lines changed

docs/build/adding-references-in-visual-cpp-projects.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@ title: "Consuming libraries and components in C++ projects"
44
ms.date: 12/18/2020
55
f1_keywords: ["VC.Project.References"]
66
helpviewer_keywords: ["Add References Dialog Box (C++)", ".NET Framework (C++), Add References Dialog Box"]
7-
ms.assetid: 12b8f571-0f21-40b3-9404-5318a57e9cb5
87
---
98
# Consuming libraries and components
109

1110
C++ projects often need to call functions or access data in a binary file such as static library (LIB files), DLL, Windows Runtime component, COM component, or .NET assembly. In these cases, you have to configure the project so that it can find that binary at build time. The specific steps depend on the type of your project, the type of the binary, and whether the binary gets built in the same solution as your project.
1211

1312
## Consuming libraries downloaded via vcpkg
1413

15-
To consume a library that you have downloaded by using the **vcpkg** package manager, you can ignore the instructions below. For more information, see [vcpkg.io](https://vcpkg.io/).
14+
To consume a library that you have downloaded by using the **vcpkg** package manager, you can ignore the instructions below. For more information, see:
15+
- [vcpkg in CMake projects](/vcpkg/users/buildsystems/cmake-integration)
16+
- [Install and use packages with CMake in Visual Studio](/vcpkg/get_started/get-started-vs)
17+
- [vcpkg in MSBuild projects](/vcpkg/users/buildsystems/msbuild-integration)
18+
- [Tutorial: Install and use packages with MSBuild in Visual Studio](/vcpkg/get_started/get-started-msbuild)
1619

1720
## Consuming static libraries
1821

docs/build/cmake-projects-in-visual-studio.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ title: "CMake projects in Visual Studio"
33
description: "How to create and build C++ projects using CMake in Visual Studio."
44
ms.date: 02/14/2022
55
helpviewer_keywords: ["CMake in Visual C++"]
6-
ms.assetid: 444d50df-215e-4d31-933a-b41841f186f8
76
---
87
# CMake projects in Visual Studio
98

@@ -177,7 +176,7 @@ You can add an existing CMake cache to an open project. It's done the same way y
177176

178177
Visual Studio uses the CMake [file-based API](https://cmake.org/cmake/help/latest/manual/cmake-file-api.7.html) (in versions 3.14 and later) to populate the editor with information specific to your project structure. For more information, see the C++ team blog post on [multi-root workspaces and file-based API](https://devblogs.microsoft.com/cppblog/visual-studio-code-cmake-tools-extension-multi-root-workspaces-and-file-based-api/).
179178

180-
Before generating the CMake cache, your custom or preferred tools may need to create a query file named *`.cmake/api/v1/query/client-MicrosoftVS/query.json`* in your build output folder (the folder that contains *`CMakeCache.txt`*). The query file should contain this content:
179+
Before generating the CMake cache, your custom or preferred tools might need to create a query file named *`.cmake/api/v1/query/client-MicrosoftVS/query.json`* in your build output folder (the folder that contains *`CMakeCache.txt`*). The query file should contain this content:
181180

182181
```json
183182
{"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]}
@@ -221,7 +220,10 @@ In Visual Studio 2019 version 16.9 and later, Visual Studio automatically config
221220

222221
## Vcpkg integration
223222

224-
CMake projects opened in Visual Studio integrate with vcpkg, a cross-platform C/C++ dependency manager. Before using vcpkg with Visual Studio, you must run `vcpkg integrate install`. For instructions and more information on vcpkg, see the [vcpkg documentation](https://vcpkg.io/).
223+
CMake projects opened in Visual Studio integrate with vcpkg, a cross-platform C/C++ dependency manager. Before using vcpkg with Visual Studio, you must run `vcpkg integrate install`. For instructions and more information about vcpkg, see:
224+
225+
- [Install and use packages with CMake in Visual Studio](/vcpkg/get_started/get-started-vs)
226+
- [vcpkg in CMake projects](/vcpkg/users/buildsystems/cmake-integration)
225227

226228
If *`CMakeSettings.json`* is your active configuration file, Visual Studio automatically passes the vcpkg toolchain file (`vcpkg.cmake`) to CMake. This behavior is disabled automatically when you specify any other toolchain in your CMake Settings configuration.
227229

@@ -346,7 +348,7 @@ As soon as you save the file, the configuration step automatically runs again an
346348

347349
When significant changes are made to the *`CMakeSettings.json`* or to *`CMakeLists.txt`* files, Visual Studio automatically reruns the CMake configure step. If the configure step finishes without errors, the information that's collected is available in C++ IntelliSense and language services. It's also used in build and debug operations.
348350

349-
Multiple CMake projects may use the same CMake configuration name (for example, x86-Debug). All of them are configured and built (in their own build root folder) when that configuration is selected. You can debug the targets from all of the CMake projects that participate in that CMake configuration.
351+
Multiple CMake projects might use the same CMake configuration name (for example, x86-Debug). All of them are configured and built (in their own build root folder) when that configuration is selected. You can debug the targets from all of the CMake projects that participate in that CMake configuration.
350352

351353
![CMake Build Only menu item.](media/cmake-build-only.png "CMake Build Only menu item")
352354

@@ -399,4 +401,6 @@ In Visual Studio 2015, Visual Studio users can use a [CMake generator](https://c
399401
[`CMakeSettings.json` schema reference](cmakesettings-reference.md)\
400402
[Configure CMake debugging sessions](configure-cmake-debugging-sessions.md)\
401403
[Deploy, run, and debug your Linux project](../linux/deploy-run-and-debug-your-linux-project.md)\
402-
[CMake predefined configuration reference](cmake-predefined-configuration-reference.md)
404+
[CMake predefined configuration reference](cmake-predefined-configuration-reference.md)\
405+
[vcpkg in CMake projects](/vcpkg/users/buildsystems/cmake-integration)\
406+
[Install and use packages with CMake in Visual Studio](/vcpkg/get_started/get-started-vs)

docs/build/creating-and-managing-visual-cpp-projects.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ Add source code files, icons, or any other items to your project by right-clicki
5353

5454
## Add third-party libraries to a project
5555

56-
Over 900 C++ open source libraries are available via the [vcpkg](https://vcpkg.io/) package manager. Run the Visual Studio integration step to set up the paths to that library when you reference it from any Visual Studio project.
56+
Over 900 C++ open source libraries are available via the [vcpkg](/vcpkg/) package manager. Run the Visual Studio integration step to set up the paths to that library when you reference it from any Visual Studio project.
57+
58+
For more information about consuming a library that you have downloaded by using the **vcpkg** package manager, see:
59+
- [vcpkg in CMake projects](/vcpkg/users/buildsystems/cmake-integration)
60+
- [Install and use packages with CMake in Visual Studio](/vcpkg/get_started/get-started-vs)
61+
- [vcpkg in MSBuild projects](/vcpkg/users/buildsystems/msbuild-integration)
62+
- [Tutorial: Install and use packages with MSBuild in Visual Studio](/vcpkg/get_started/get-started-msbuild)
5763

5864
They're also commercial third-party libraries that you can install. Follow their installation instructions.
5965

docs/build/get-started-linux-cmake.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,5 @@ Learn more about configuring and debugging CMake projects in Visual Studio:
207207
> [Configure CMake debugging sessions](configure-cmake-debugging-sessions.md)<br/><br/>
208208
> [Deploy, run, and debug your Linux project](../linux/deploy-run-and-debug-your-linux-project.md)<br/><br/>
209209
> [CMake predefined configuration reference](cmake-predefined-configuration-reference.md)
210-
>
210+
> [vcpkg in CMake projects](/vcpkg/users/buildsystems/cmake-integration)
211+
> [Install and use packages with CMake in Visual Studio](/vcpkg/get_started/get-started-vs)

docs/build/walkthrough-using-msbuild-to-create-a-visual-cpp-project.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,15 @@ This walkthrough demonstrates how to use MSBuild in a command prompt to build a
1414
This walkthrough illustrates these tasks:
1515

1616
- Creating the C++ source files for your project.
17-
1817
- Creating the XML MSBuild project file.
19-
2018
- Using MSBuild to build your project.
21-
2219
- Using MSBuild to customize your project.
2320

2421
## Prerequisites
2522

2623
You need these prerequisites to complete this walkthrough:
2724

2825
- A copy of Visual Studio with the **Desktop development with C++** workload installed.
29-
3026
- A general understanding of the MSBuild system.
3127

3228
::: moniker range="msvc-140"
@@ -57,7 +53,6 @@ In this walkthrough, you'll create a project that has a source file and a header
5753
### To create the C++ source files for your project
5854

5955
1. Create a folder for your project.
60-
6156
1. Create a file named *`main.cpp`* and add this code to the file:
6257

6358
```cpp
@@ -83,9 +78,7 @@ In this walkthrough, you'll create a project that has a source file and a header
8378
An MSBuild project file is an XML file that contains a project root element (`<Project>`). In the example project you'll build, the `<Project>` element contains seven child elements:
8479

8580
- Three item group tags (`<ItemGroup>`) that specify project configuration and platform, source file name, and header file name.
86-
8781
- Three import tags (`<Import>`) that specify the location of Microsoft Visual C++ settings.
88-
8982
- A property group tag (`<PropertyGroup>`) that specifies project settings.
9083

9184
### To create the MSBuild project file
@@ -209,13 +202,9 @@ The application should display "Hello, from MSBuild!" in the console window.
209202
MSBuild enables you to execute predefined build targets, apply user-defined properties, and use custom tools, events, and build steps. This section illustrates these tasks:
210203

211204
- Using MSBuild with build targets.
212-
213205
- Using MSBuild with build properties.
214-
215206
- Using MSBuild with the 64-bit compiler and tools.
216-
217207
- Using MSBuild with different toolsets.
218-
219208
- Adding MSBuild customizations.
220209

221210
### Using MSBuild with Build Targets
@@ -277,7 +266,10 @@ To rebuild your project with the Visual C++ 11.0 Windows XP toolset, enter this
277266
MSBuild provides various ways to customize your build process. These articles show how to add custom build steps, tools, and events to your MSBuild project:
278267

279268
- [How to: Add a Custom Build Step to MSBuild Projects](how-to-add-a-custom-build-step-to-msbuild-projects.md)
280-
281269
- [How to: Add Custom Build Tools to MSBuild Projects](how-to-add-custom-build-tools-to-msbuild-projects.md)
282-
283270
- [How to: Use Build Events in MSBuild Projects](how-to-use-build-events-in-msbuild-projects.md)
271+
272+
## See also
273+
274+
- [vcpkg in MSBuild projects](/vcpkg/users/buildsystems/msbuild-integration)
275+
- [Tutorial: Install and use packages with MSBuild in Visual Studio](/vcpkg/get_started/get-started-msbuild)

0 commit comments

Comments
 (0)