Skip to content

Commit 9df7b1f

Browse files
Taojunshensweemeresweet431opbld16Colin Robertson
authored
1/4/2022 AM Publish (#4019)
* Update cmake-presets-vs.md Add instructions for configuring clang-cl with the ClangCL toolset configure preset instead of by setting CMAKE_C_COMPILER and CMAKE_CXX_COMPILER in cacheVariables. * Add gray border * LinkFix: cpp-docs-pr (2021-11) * Clarify C4146 per VCSig list (#3923) * Clarify C4146 per VCSig list * Fix link issues. * Update enable CMake Presets * fix rel links * fix github 3528 * acrolinx * change order of example * Add version info to NMAKE macro functions * Bulk fix entity `&amp;` part 3 * threshhold test * Eliminate even more `&amp;` entities * Minimum Viable Phix * Once more into the `&amp;` breech * Add Visual Studio 2022 Platform Toolset Version * Add /fpcvt compiler option docs (#3886) * Add /fpcvt compiler option docs * Fix copypasta error * Update fp conversion intrinsics, too. * Replace deleted table row * Acrolinx pass * Fix TOC issues * Add useful links to intrinsics * Updates per John Morgan, plus acrolink * Update version info * Clean up rvalue reference article * Fix to `/fpcvt` per John Morgan email * Reformat WeakRef class document. * Update Advanced prop page and C1107 * Remove unrelated change. * Minimizing entity form of & (#3916) * Initial pass minimizing on &gt; entities (#3919) * Initial pass on &gt; entities * Fix everything. * Try without `&lt;` entities in title/desc * Clean up pass * Update docs/atl-mfc-shared/reference/cfiletime-class.md Co-authored-by: Tracey Torble <[email protected]> * Update tn026-ddx-and-ddv-routines.md `DoDialogExchange` -> `DoDataExchange` * Fix incorrect import example * github fix 3544 * GITHUB FIX FOR #3549 * Add UWP to list of unsupported ASAN features. * Fix misnamed mt.exe options. Acrolinx all. * Attempt fpcvt simplification per John Morgan. * Fix cpp-docs 3546 * Address complaint in cpp-docs 3554 (#3950) * Add section on CMake partial activation * 17.1 Update warnings, fix cpp-docs 3563 (#3954) * 17.1 Update warnings, fix cpp-docs 3563 * fix date * Add `/Zc:externC` compiler option doc, fix 1594 * Tweaks. * Fix links, header syntax issues * Fix issues in XML Docs reference * Make list match apparently intended style * Fix broken link. * Add docs for new check Signed-off-by: Kyle Reed <[email protected]> * fix toc * remove .md from toc title * Revert "Add docs for new linter check" * update runtime spelling * Bulk fix: remove HTML entities from yml headers (#3962) * Style and content fixes in cpp language docs * Changing confusing wording about C++ exceptions * Bulk fix HTML entities in H1 (#3966) * Fix lt-gt entity pairs * Bulk fix of `&lt;`-`&gt;` pairs in H1 headings * Oops, deleted initial `#` * Fix two more H1 issues * update with existing .openpublishing.publish.config.json * C++ tutorial landing page, attempt 2 * Revert redirection of get-started index.yml file * Fix typo * Bulk fix `&lt;`, `&gt;`, and `.period;` entities * operatoroperator * `/hotpatch`: No jump to the first instruction * Update Acrolinx for main branch * Change learn about item type * Add get started TOC * fix over machine translation problems (#3977) * fix over machine translation problems * acrolinx and misses * markdown fixes Co-authored-by: TylerMSFT <[email protected]> * Make the grammar bot happy * Fix things that look like parameters. (#3978) * Fix things that look like parameters. * Acrolinxy * Misc fixes * Other fixes * Fix typos * Acrolinx some more * [17.0] Update links to download Visual Studio (#3981) * Update links to download Visual Studio * Remove VS 2019 reference * Address cpp-docs 3565 * Also cpp-docs 439 * cpp-docs 947 * cpp-docs 1002 * accuratized * cpp-docs 1035 * Twhitney named modules (#3960) * draft * draft * draft * fix links * cleanup * added some more info * add some see also references * cleanup pass * remove text about overloads * tech review * little better wording * a little more word smithing * fix link * acrolinx * readthrough pass * Readthrough to test building the project * acrolinx * rename media file Co-authored-by: TylerMSFT <[email protected]> * cpp-docs 1305 * cpp-docs 1324 * address github issue #3524 and add code escape to prevent over machine translation * missed a couple escapes * couple more code escapes * one more escape * Address cpp-docs 3583: LNK1107 clarity * Tweaks * tweak formatting * Expand on fix for cpp-docs 1035 (#3986) * Expand of fix for cpp-docs 1035 * Mention overloads. * Grammar and formatting fixes * add summary of what will learn in module * [17.1p2] Add docs for comparison/bitwise c++ linter check. (#3964) * Revert "Revert "Add docs for new linter check"" This reverts commit e56971f. * PR feedback Signed-off-by: Kyle Reed <[email protected]> * Update cmake-presets-vs.md * Update cmake-presets-vs.md * Switch http to https and fix broken links * Acrolinx * Style pass for the grammar checker bot * Fix two incorrect conditions in the ARM packed exception handling For the prologue, the distinction between `mov r11, sp` and `add r11, sp, #xx` lies only in whether other registers are pushed before R11 and LR in prologue instruction 2. (The condition `R`==1 and `PF`==0 corresponds to no other registers pushed before `r11`.) The `L` flag doesn't affect it (and the documentation explicit says that when `C` is set, then `L` also must be set, thus `C`==1 and `L`==0 is tautological too). This was correctly described in the textual form, but the conditions in the table included one erronous case. For the epilogue, when `Ret`!=0, the function doesn't return by popping LR directly into PC, but with an explicit branch instruction (10a or 10b). In this case, if `L`==1, the LR register is included in the list of registers popped in instruction 8. If register homing is used (`H`==1), then instruction 9a is used instead of 9b. This case seemed to have been overlooked both in the textual description and in the table. Also, when prologue instruction form 3a is used, clarify that it corresponds to the unwind code FB (narrow nop) only, that unwinding such a prologue doesn't restore `sp` from `r11`. Also fix a typo and clarify that encodings with C=1, L=0 are invalid. * Address cpp-docs 3588 error in link commands (#3996) * Address cpp-docs 3588 error in link commands * Update ms.date * Acrolinx fixes to frontrun cpp-docs 3541 * Post-3541 acrolinx pass * Update how-to-marshal-structures-using-cpp-interop.md Change "=" into "-" * Add _CountOneBits[64] to the ARM64 intrinsic doc * Update .acrolinx-config.edn update to reflect default branch name change * update json examples (#4017) * update json examples * acrolinx Co-authored-by: TylerMSFT <[email protected]> * fix github issue #3600 * formatting cleanup and acrolinx Co-authored-by: Jonathan Sweemer <[email protected]> Co-authored-by: Erika <[email protected]> Co-authored-by: opbld16 <[email protected]> Co-authored-by: Colin Robertson <[email protected]> Co-authored-by: opbld17 <[email protected]> Co-authored-by: Christopher McClister <[email protected]> Co-authored-by: PRMerger16 <[email protected]> Co-authored-by: Laura Brenner <[email protected]> Co-authored-by: opbld15 <[email protected]> Co-authored-by: TylerMSFT <[email protected]> Co-authored-by: PRMerger18 <[email protected]> Co-authored-by: PRMerger4 <[email protected]> Co-authored-by: PRMerger6 <[email protected]> Co-authored-by: MohammadHadi Attarieh <[email protected]> Co-authored-by: PRMerger15 <[email protected]> Co-authored-by: PRMerger10 <[email protected]> Co-authored-by: Haig MacGregor <[email protected]> Co-authored-by: Tracey Torble <[email protected]> Co-authored-by: Waiting <[email protected]> Co-authored-by: roxk <[email protected]> Co-authored-by: Tyler Whitney <[email protected]> Co-authored-by: branh <[email protected]> Co-authored-by: John Ellison <[email protected]> Co-authored-by: PRMerger8 <[email protected]> Co-authored-by: PRMerger17 <[email protected]> Co-authored-by: Sam Freed <[email protected]> Co-authored-by: Colin Cooper <[email protected]> Co-authored-by: Paula Miller <[email protected]> Co-authored-by: Kyle Reed <[email protected]> Co-authored-by: Hannes Harnisch <[email protected]> Co-authored-by: Anna Huff <[email protected]> Co-authored-by: Ying Hua <[email protected]> Co-authored-by: Alex Guteniev <[email protected]> Co-authored-by: Dennis Rea <[email protected]> Co-authored-by: PRMerger3 <[email protected]> Co-authored-by: PRMerger Service account 2 <[email protected]> Co-authored-by: Martin Storsjö <[email protected]> Co-authored-by: Kristine Toliver <[email protected]> Co-authored-by: AndreaLu <[email protected]> Co-authored-by: Matt Gardner <[email protected]> Co-authored-by: Sarah Vilaysom <[email protected]>
1 parent 6e26222 commit 9df7b1f

File tree

2 files changed

+717
-734
lines changed

2 files changed

+717
-734
lines changed

docs/linux/cmake-linux-configure.md

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Configure a Linux CMake project in Visual Studio"
33
description: "How to configure Linux CMake settings in Visual Studio"
4-
ms.date: "08/08/2020"
4+
ms.date: 01/03/2022
55
---
66
# Configure a Linux CMake project in Visual Studio
77

@@ -10,11 +10,11 @@ Linux support is available in Visual Studio 2017 and later. To see the documenta
1010
::: moniker-end
1111

1212
::: moniker range=">=msvc-150"
13-
This topic describes how to add a Linux configuration to a CMake project that targets either a remote Linux system or Windows Subsystem for Linux (WSL). It continues the series that began with [Create a Linux CMake project in Visual Studio](cmake-linux-project.md). If you are using MSBuild, instead, see [Configure a Linux MSBuild Project in Visual Studio](configure-a-linux-project.md)
13+
This topic describes how to add a Linux configuration to a CMake project that targets either a remote Linux system or Windows Subsystem for Linux (WSL). It continues the series that began with [Create a Linux CMake project in Visual Studio](cmake-linux-project.md). If you're using MSBuild, instead, see [Configure a Linux MSBuild Project in Visual Studio](configure-a-linux-project.md)
1414

1515
## Add a Linux configuration
1616

17-
A configuration can be used to target different platforms (Windows, WSL, a remote system) with the same source code. A configuration is also used to set your compilers, pass environment variables, and customize how CMake is invoked. The *CMakeSettings.json* file specifies some or all of the properties listed in [Customize CMake settings](../build/customize-cmake-settings.md), plus additional properties that control the build settings on the remote Linux machine.
17+
A configuration can be used to target different platforms (Windows, WSL, a remote system) with the same source code. A configuration is also used to set your compilers, pass environment variables, and customize how CMake is invoked. The *CMakeSettings.json* file specifies some or all of the properties listed in [Customize CMake settings](../build/customize-cmake-settings.md), plus other properties that control the build settings on the remote Linux machine.
1818
::: moniker-end
1919

2020
::: moniker range="msvc-150"
@@ -24,27 +24,36 @@ The default configuration for Linux-Debug in Visual Studio 2017 (and Visual Stud
2424

2525
```json
2626
{
27+
"configurations": [
28+
{
2729
"name": "Linux-Debug",
2830
"generator": "Unix Makefiles",
2931
"remoteMachineName": "${defaultRemoteMachineName}",
3032
"configurationType": "Debug",
3133
"remoteCMakeListsRoot": "/var/tmp/src/${workspaceHash}/${name}",
3234
"cmakeExecutable": "/usr/local/bin/cmake",
33-
"buildRoot": "${env.LOCALAPPDATA}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
34-
"installRoot": "${env.LOCALAPPDATA}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
35+
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
36+
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
3537
"remoteBuildRoot": "/var/tmp/build/${workspaceHash}/build/${name}",
3638
"remoteInstallRoot": "/var/tmp/build/${workspaceHash}/install/${name}",
3739
"remoteCopySources": true,
3840
"remoteCopySourcesOutputVerbosity": "Normal",
3941
"remoteCopySourcesConcurrentCopies": "10",
4042
"remoteCopySourcesMethod": "rsync",
41-
"remoteCopySourcesExclusionList": [".vs", ".git"],
42-
"rsyncCommandArgs" : "-t --delete --delete-excluded",
43-
"remoteCopyBuildOutput" : "false",
43+
"remoteCopySourcesExclusionList": [
44+
".vs",
45+
".git"
46+
],
47+
"rsyncCommandArgs": "-t --delete --delete-excluded",
48+
"remoteCopyBuildOutput": false,
4449
"cmakeCommandArgs": "",
4550
"buildCommandArgs": "",
4651
"ctestCommandArgs": "",
47-
"inheritEnvironments": [ "linux-x64" ]
52+
"inheritEnvironments": [
53+
"linux_x64"
54+
]
55+
}
56+
]
4857
}
4958
```
5059

@@ -55,16 +64,18 @@ To change the default CMake settings in Visual Studio 2019 or later, from the ma
5564

5665
![Screenshot showing CMake Manage Configurations highlighted in the Configuration dropdown.](../build/media/vs2019-cmake-manage-configurations.png "CMake configurations drop-down")
5766

58-
This command opens the **CMake Settings Editor**, which you can use to edit the *CMakeSettings.json* file in your root project folder. You can also open the file with the JSON editor by clicking the **Edit JSON** button in the editor. For more information, see [Customize CMake Settings](../build/customize-cmake-settings.md).
67+
This command opens the **CMake Settings Editor**, which you can use to edit the *CMakeSettings.json* file in your root project folder. You can also open the file with the JSON editor by clicking the **Edit JSON** button in the upper-right of the **CMake Settings** dialog. For more information, see [Customize CMake Settings](../build/customize-cmake-settings.md).
5968

6069
The default Linux-Debug configuration in Visual Studio 2019 version 16.1, and later, looks like this:
6170

6271
```json
6372
{
64-
"name": "Linux-Debug",
65-
"generator": "Unix Makefiles",
73+
"configurations": [
74+
{
75+
"name": "Linux-GCC-Debug",
76+
"generator": "Ninja",
6677
"configurationType": "Debug",
67-
"cmakeExecutable": "/usr/bin/cmake",
78+
"cmakeExecutable": "cmake",
6879
"remoteCopySourcesExclusionList": [ ".vs", ".git", "out" ],
6980
"cmakeCommandArgs": "",
7081
"buildCommandArgs": "",
@@ -78,7 +89,6 @@ The default Linux-Debug configuration in Visual Studio 2019 version 16.1, and la
7889
"rsyncCommandArgs": "-t --delete --delete-excluded",
7990
"remoteCopyBuildOutput": false,
8091
"remoteCopySourcesMethod": "rsync",
81-
"addressSanitizerRuntimeFlags": "detect_leaks=0",
8292
"variables": []
8393
}
8494
]
@@ -98,7 +108,7 @@ When you do a build:
98108

99109
## Choose a Linux target
100110

101-
When you open a CMake project folder, Visual Studio parses the *CMakeLists.txt* file and specifies a Windows target of **x86-Debug**. To target a remote Linux system, you'll change the project settings based on your Linux compiler. For example, if you are using GCC on Linux and compiling with debug info, you'll chose: **Linux-GCC-Debug** or **Linux-GCC-Release**.
111+
When you open a CMake project folder, Visual Studio parses the *CMakeLists.txt* file and specifies a Windows target of **x86-Debug**. To target a remote Linux system, you'll change the project settings based on your Linux compiler. For example, if you're using GCC on Linux and compiling with debug info, choose: **Linux-GCC-Debug** or **Linux-GCC-Release**.
102112

103113
If you specify a remote Linux target, your source is copied to the remote system.
104114

@@ -121,7 +131,7 @@ The **CMakeSettings.json** window appears.
121131

122132
![Add configuration.](media/cmake-linux-configurations.png "Add a configuration to CMake settings")
123133

124-
Press **Add Configuration** (the green '+' button) and then choose **Linux-GCC-Debug** or **Linux-GCC-Release** if using GCC. Use the Clang variants if you are using the Clang/LLVM toolset. Press **Select** and then **Ctrl+S** to save the configuration.
134+
Press **Add Configuration** (the green '+' button) and then choose **Linux-GCC-Debug** or **Linux-GCC-Release** if using GCC. Use the Clang variants if you're using the Clang/LLVM toolset. Press **Select** and then **Ctrl+S** to save the configuration.
125135

126136
**Visual Studio 2019 version 16.1** When you target WSL, Visual Studio doesn't need to copy source files and maintain two synchronous copies of your build tree because the compiler on Linux has direct access to your source files in the mounted Windows file system.
127137
::: moniker-end
@@ -135,7 +145,7 @@ Accurate C++ IntelliSense requires access to the C++ headers referenced by your
135145

136146
Visual Studio language settings aren't propagated to Linux targets because Visual Studio doesn't manage or configure installed packages. Messages shown in the Output window, such as build errors, are shown using the language and locale of the Linux target. You'll need to configure your Linux targets for the desired locale.
137147

138-
## Additional settings
148+
## More settings
139149

140150
Use the following settings to run commands on the Linux system before and after building, and before CMake generation. The values can be any command that is valid on the remote system. The output is piped back to Visual Studio.
141151

0 commit comments

Comments
 (0)