CMake integration in Visual Studio Code
Перейти к файлу
vector-of-bool df2ef066ea Fix garbled Kit selection UI. [Fix #384] 2018-03-25 15:45:04 -06:00
.vscode Add debug config for vs-preferred-gen 2018-03-17 16:54:40 -06:00
docs Fix misaligned title 2018-03-16 22:34:43 -06:00
images Updated Target Debugging documentation 2017-06-13 15:27:41 +02:00
res Bad git! No! (Don't change line endings in executables) 2017-12-18 20:09:12 -07:00
schemas Replace visualStudioVersion by visualStudio 2017-12-24 13:43:43 +01:00
scripts Clean out build files before CI and fix typedoc command 2018-03-17 16:54:05 -06:00
src Fix garbled Kit selection UI. [Fix #384] 2018-03-25 15:45:04 -06:00
test Fix message check in tests 2018-03-21 21:16:24 +01:00
.clang-format .clang-format changes: 2018-03-03 14:39:32 -07:00
.gitattributes Bad git! No! (Don't change line endings in executables) 2017-12-18 20:09:12 -07:00
.gitignore Adding PowerShell-based scripts for Linux and macOS 2018-03-11 20:25:17 -06:00
.travis.yml Fix Travis. But for real. 2018-03-17 18:06:41 -06:00
.vscodeignore Adding PowerShell-based scripts for Linux and macOS 2018-03-11 20:25:17 -06:00
CHANGELOG.md Update README and version 2017-07-16 18:14:49 -06:00
LICENSE.txt Pull in a LICENSE from develop 2018-02-27 23:11:37 -07:00
README.md Update README and version 2017-07-16 18:14:49 -06:00
THIRD.md Use bundled vswhere.exe 2017-12-18 17:29:44 -07:00
appveyor.yml Remove VS2013 image from appveyor 2018-03-19 22:05:20 +01:00
package-lock.json Initial version of contributing guidelines. 2018-03-11 00:33:17 +01:00
package.json Support project-specific Kits. 2018-03-18 00:35:29 -06:00
tsconfig.json Don't check libs (fixes compile error with highlight.js) 2017-11-16 18:58:59 -07:00
tslint.json More tslint 2018-03-03 14:55:13 -07:00

README.md

CMake Tools

CMake Tools provides the native developer a full-featured, convenient, and powerful configure+build workflow for CMake-based projects within the Visual Studio Code editor.

This extension itself does not provide language support for the CMake scripting language. For that I recommend this extension.

Calling All Users:

One of the number-one most important things I need help with is documentation. The changelog may mention all important changes and features, but it's hard for a new user to get acclimated and find all the features and options.

If you'd like to help, please head on over to the GitHub project's wiki, or add a PR for relevant information in the docs/ subdirectory.

What's New?

0.10.0

  • VS 2017 environment detection! Finally! Note: We use vswhere to find the local Visual Studio installation, and this program is only bundled with Visual Studio 2017 Update 2 (or newer). Please install (at least) update 2 for automatic detection to work
  • Lots of small bugfixes and tweaks, and debugging documentation updates. Many thanks to Yuri Timenkov!
  • 0.10.1:
    • Option cmake.buildBeforeRun to enable/disable building of a target before running/debugging it. (Default is enabled)
    • Changes in the way Visual Studio generators are loaded and detected. Now, generators for detected build environments are added to the preferred list. (Thanks to Yuri Timenkov!)
    • Fix issue where cmake-server could be restarted too quickly and break itself.
    • ${variable} substitution is now supported in the cmake.*Environment settings. (Thanks to Damien Courtois!)
  • 0.10.2:
    • Support for Emscripten environment detection. Set the cmake.emscriptenSearchDirs setting or the EMSCRIPTEN environment variable to the root path of the Emscripten SDK (Contains cmake/Modules/Platform/Emscripten.cmake)
    • Fix environment variables not passing from settings.json to configuration.

As always: Please report any issues, questions, or comments to the GitHub project issues list!

Issues? Questions? Feature requests?

PLEASE, if you experience any problems, have any questions, or have an idea for a new feature, create an issue on the GitHub page!

I'm only one person with no QA team, so I can't test all the different possible configurations you may have, but I'll gladly help anyone fix issues relating to this extension.

Getting Started

CMake Tools provides several pieces of functionality to make it easier to work with CMake-based projects within Visual Studio Code. For example, it adds a "CMake: Build" command to the command palette, which is bound to the F7 key by default.

By default, CMake Tools assumes that you place your CMake build tree in a subdirectory of the source tree called build. This can be configured with the cmake.buildDirectory configuration option, which can be set globally or on a per-project basis. If you try to build but do not yet have a build directory, CMake Tools will prompt you to configure the project.

CMake Tools uses a configuration setting cmake.configureSettings to define options to pass to CMake when configuring the project. In this way, build settings can be stored as part of the project in settings.json in the .vscode directory.

The Status bar

CMake Status Bar Items

CMake Tools provides a few buttons on the statusbar:

  1. The name of the current project, the current build type (Debug, Release, etc.), and the current status of CMake Tools. Click this button to change the active configuration.
  2. A build button. Click this button to build the default target. Quickly invoking a build is also bound to the F7 key by default. While building, this button changes into a stop button. Clicking the stop button will cancel the currently running build/configure process.
  3. The default/active target. This is the target that will be invoked if run the build command. Clicking on this button will let you select a different target to be built by default.
  4. The Target Debugging launcher (must be explicitly enabled, see below).
  5. The active debug target (must be explicitly enabled).
  6. The CTest results button. Click this button to rebuild and run CTest tests.

CMake Tools will also show the most recent line of CMake output as a status message to the right of the buttons. Invoking a command will open the CMake/Build output channel, where the progress and output of the build/configure commands can be seen.

Target Debugging

Target Debugging, allows developers to easily use the Visual Studio Code Debugger with their CMake targets without having to write a launch.json. Read about enabling and using the feature here.

Compiler Diagnostics

CMake Tools also parses the compiler output of GCC, Clang, and MSVC looking for diagnostics. It will populate the diagnostics for files which produce any warnings or errors.

CTest Tests

CMake Tools also features integration with CTest, both executing and displaying results, even inline in the editor:

Failing Check

(Currently, only Catch test output is supported)

Other Features

  • Command to quickly generate a very basic CMakeLists.txt and C++ source file.
  • Set CMake configuration values in settings.json.
  • Provides diagnostics for CMake scripts.
  • Quickly jump into CMakeCache.txt