Skip to content

Commit

Permalink
Merge branch 'dev/gcampbell/FixRegression' of https://github.com/micr…
Browse files Browse the repository at this point in the history
…osoft/vscode-cmake-tools into dev/gcampbell/FixRegression
  • Loading branch information
gcampbell-msft committed Nov 15, 2023
2 parents 5e2e0f7 + e852934 commit 1d1e791
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 20 deletions.
12 changes: 6 additions & 6 deletions docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ The results of the build are written to the directory specified by [cmake.buildD

CMake Tools persists a "default target" for the build process. The default target is the "all" target (named `ALL_BUILD` in some generators), which builds all of the targets that CMake has designated for a default build.

The name of the default target is shown in the status bar to the right of the **Build** button in square brackets:
The name of the default target is shown in the CMake Tools sidebar underneath the **Build** node:

![Default target as shown in the status bar](images/default_target.png)
![Default target as shown in the status bar](images/build-target.png)

Selecting this button shows a quick pick list for all the targets CMake Tools is aware of that can be built, along with the full path to the build result that will be generated by the target:

![List of targets](images/target_selector.png)
![List of targets](images/new-cmake-target-options.png)

## Build a single target

You can build a single target without changing the current build target from the VS Code command pallette by running the **CMake: Build a target** command, or by pressing the keyboard shortcut (default is `Shift+F7`). CMake will build any dependent targets, even if they aren't directly selected.
You can build a single target without changing the current build target from the VS Code command palette by running the **CMake: Build Target** command, or by pressing the keyboard shortcut (default is `Shift+F7`). CMake will build any dependent targets, even if they aren't directly selected.

## Create a build task
You can also define a build task from the VS Code command pallette by running the **Tasks: Configure task** command.
You can also define a build task from the VS Code command palette by running the **Tasks: Configure Task** command.

![Configure a build task](images/configure_task.png)

Expand Down Expand Up @@ -115,4 +115,4 @@ To clean the build, from the VS Code command pallette run the **CMake: Clean** c

- Use CMake Tools to [launch and debug](debug-launch.md)
- Learn about [CMake settings](cmake-settings.md#cmake-settings) you can set to control the build.
- Explore the [CMake Tools documentation](README.md)
- Explore the [CMake Tools documentation](README.md)
16 changes: 8 additions & 8 deletions docs/cmake-presets.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ You can configure and build your CMake project by using a series of commands. Op

### CMake: Select Configure Preset

**CMake: Select Configure Preset** lists the union of non-hidden Configure Presets defined in `CMakePresets.json` and `CMakeUserPresets.json`. Select a Configure Preset to make it the active Configure Preset. This is the `configurePreset` value that's used when CMake is invoked to generate the project build system. The active Configure Preset appears on the status bar.
**CMake: Select Configure Preset** lists the union of non-hidden Configure Presets defined in `CMakePresets.json` and `CMakeUserPresets.json`. Select a Configure Preset to make it the active Configure Preset. This is the `configurePreset` value that's used when CMake is invoked to generate the project build system. The active Configure Preset appears in the Project Status View on the CMake Tools sidebar.

CMake Tools uses the value of `hostOS` in the Microsoft Visual Studio Settings vendor map to hide Configure Presets that don't apply to your platform. For more information, see the entry for `hostOS` in the table under [Visual Studio Settings vendor map](https://docs.microsoft.com/cpp/build/cmake-presets-json-reference#visual-studio-settings-vendor-map).

Expand All @@ -48,7 +48,7 @@ To configure the project, run **CMake: Configure** from the command palette. Thi
### CMake: Select Build Preset

**CMake: Select Build Preset** lists the Default Build Preset and the union of non-hidden Build Presets defined in `CMakePresets.json` and `CMakeUserPresets.json`. The Default Build Preset is equivalent to passing `cmake --build` with no additional arguments from the command line. Select a Build Preset to make it the active Build Preset. This is the `buildPreset` value that's used when CMake is invoked to build the project. The active Build Preset is displayed on the status bar.
**CMake: Select Build Preset** lists the Default Build Preset and the union of non-hidden Build Presets defined in `CMakePresets.json` and `CMakeUserPresets.json`. The Default Build Preset is equivalent to passing `cmake --build` with no additional arguments from the command line. Select a Build Preset to make it the active Build Preset. This is the `buildPreset` value that's used when CMake is invoked to build the project. The active Build Preset is displayed in the Project Status View on the CMake Tools sidebar.

All Build Presets must specify an associated `configurePreset` value. CMake Tools hides Build Presets that don't apply to the active Configure Preset. For more information, see the [list of Build Presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html#build-preset).

Expand All @@ -66,21 +66,21 @@ CTest is the CMake test driver program and is integrated with the CMake Tools ex

**CMake: Select Test Preset** lists the default Test Preset and the union of non-hidden Test Presets defined in `CMakePresets.json` and `CMakeUserPresets.json`. The default Test Preset is the same as invoking `ctest` with no other arguments from the command line.

Select a Test Preset to make it the active Test Preset. This is the `testPreset` value that will be used when you invoke CTest to run tests. The active Test Preset appears on the status bar.
Select a Test Preset to make it the active Test Preset. This is the `testPreset` value that will be used when you invoke CTest to run tests. The active Test Preset appears in the Project Status View on the CMake Tools sidebar.

All Test Presets must specify an associated `configurePreset` value. CMake Tools will hide Test Presets that don't apply to the active Configure Preset. For more information, see the [list of Test Presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html#test-preset).

### CMake: Run Tests

To invoke CTest, run **CMake: Run Tests from the command palette**. This is the same as running `ctest --preset <testPreset>` from the command line, where `<testPreset>` is the name of the active Test Preset.
To invoke CTest, run **CMake: Run Tests** from the command palette. This is the same as running `ctest --preset <testPreset>` from the command line, where `<testPreset>` is the name of the active Test Preset.

### Status bar behavior
### CMake Tools side bar Project Status View behavior

The status bar displays the active Configure Preset, Build Preset, and Test Preset:
The CMake Tools Project Status View in the sidebar displays the active Configure Preset, Build Preset, and Test Preset under their respective Configure, Build, and Test Nodes. You can select each option to change the active preset:

![Screenshot of the Visual Studio Code status bar, showing the active Configure Preset, Build Preset, and Test Preset.](images/status_bar_preset_status.png)
![Screenshot of the CMake sidebar Project Status View, showing the active Configure Preset, Build Preset, and Test Preset.](images/cmake-presets.png)

To show or hide individual status bar icons, you can modify `cmake.statusbar.advanced` in `settings.json`.
To show or hide individual status bar icons, you can modify `cmake.options.advanced` in `settings.json`. For more information on how to configure your view, please see our [CMake view configuration docs](cmake-options-configuration.md)

## Add new presets

Expand Down
16 changes: 10 additions & 6 deletions docs/debug-launch.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,26 @@ By default, launching or debugging an executable target causes it to be built fi

The first time you run target debugging, CMake Tools asks for you to specify a target, which will be persisted between sessions.

The active launch target is shown in the status bar to the right of the *Debug* and *Play* buttons:
The active launch target is shown in the CMake Tools sidebar Project Status View under the `Launch` node:

![Image of launch target to the right of the debug and run button](images/launch_debugv2.png)
![Image of launch target to the right of the debug and run button](images/launch-debugv2.png)

Selecting the active launch target button will show the launch target selector so that you can change the active launch target.

From there, you can press the play button by the `Launch` node to run it in terminal.

![Image of running in terminal when you hover over the Launch node](images/launch-target.png)

## Debugging without a launch.json

CMake Tools lets you start a debugger on a target without creating a `launch.json`.

> **Note:**
> Only the debugger from Microsoft's `vscode-ms-vscode.cpptools` extension supports quick-debugging. See [Debug using a launch.json file](#debug-using-a-launchjson-file), below, for information about `launch.json` and using other debuggers.
Start a debugging session on the active target by running the *CMake: Debug* command from the VS Code command pallette, by selecting the Debug button in the status bar, or by pressing the keyboard shortcut (the default is **Ctrl+F5**).
Start a debugging session on the active target by running the *CMake: Debug* command from the VS Code command palette, by selecting the Debug button in the status bar or CMake Tools sidebar Project Status View, or by pressing the keyboard shortcut (the default is **Ctrl+F5**).

![Image of launching the debugger for the selected target](images/debug_target.png)
![Image of launching the debugger for the selected target](images/debug-targetv2.png)

> **Note:**
> Quick-debugging does not let you specify program arguments or other debugging options. See the next section for more options.
Expand Down Expand Up @@ -225,9 +229,9 @@ Depending on your configuration or your settings, there may need to be additiona

## Run without debugging

You can run a target without debugging it, by running the *CMake: Run without Debugging* from VS Code's command palatte, by selecting the play button in the status bar, or by pressing the keyboard shortcut (the default `Shift+F5`).
You can run a target without debugging it, by running the *CMake: Run Without Debugging* from VS Code's command palette, by selecting the play button in the status bar or the play button to the left of the Launch node, or by pressing the keyboard shortcut (the default `Shift+F5`).

![Image of launching the selected target in the terminal window](images/run_target.png)
![Image of launching the selected target in the terminal window](images/launch-target.png)

The output of the target will be shown in an integrated terminal.

Expand Down
Binary file added docs/images/build-target.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/cmake-presets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/debug-targetv2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/launch-debugv2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/launch-target.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/new-cmake-target-options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1d1e791

Please sign in to comment.