Create a CMake Linux project in Visual Studio

Create a CMake Linux project in Visual Studio
  • Article
  • 3 minutes to check out

Linux assistance is offered in Visual Studio 2017 and later on. To see the paperwork for these variations, set the Version drop-down situated above the tabulation to Visual Studio 2017 or Visual Studio 2019

We advise you utilize CMake for jobs that are cross-platform or will be made open-source. You can utilize CMake jobs to construct and debug the very same source code on Windows, the Windows Subsystem for Linux (WSL), and remote systems.

Before you start

First, ensure you have the Visual Studio Linux work set up, consisting of the CMake part. That’s the Linux advancement with C++ work in the Visual Studio installer. See Install the C++ Linux work in Visual Studio if you aren’t sure you have actually that set up.

Also, make certain the following are set up on the remote maker:

  • gcc
  • gdb
  • rsync
  • zip
  • ninja-build (Visual Studio 2019 or above)
The CMake assistance in Visual Studio needs server mode assistance presented in CMake 3.8. For a Microsoft-provided CMake version, download the current prebuilt binaries at https://github.com/Microsoft/CMake/releases

The binaries are set up in ~/. vs/cmake After releasing the binaries, your job instantly restores. If the CMake defined by the cmakeExecutable field in CMakeSettings.json is void (it does not exist or is an unsupported variation), and the prebuilt binaries exist, Visual Studio overlooks cmakeExecutable and utilizes the prebuilt binaries.

Visual Studio 2017 can’t produce a CMake task from scratch, however you can open a folder which contains an existing CMake task, as explained in the next area.

You can utilize Visual Studio 2019 to construct and debug on a remote Linux system or WSL, and CMake will be conjured up on that system. Cmake variation 3.14 or later on must be set up on the target device.

Make sure that the target maker has a current variation of CMake. Frequently, the variation used by a circulation’s default bundle supervisor isn’t current enough to support all the functions needed by Visual Studio. Visual Studio 2019 discovers whether a current variation of CMake is set up on the Linux system. If none is discovered, Visual Studio reveals an info-bar at the top of the editor pane. It uses to set up CMake for you from https://github.com/Microsoft/CMake/releases

With Visual Studio 2019, you can produce a CMake task from scratch, or open an existing CMake job. To develop a brand-new CMake task, follow the guidelines listed below. Or avoid ahead to Open a CMake task folder if you currently have a CMake task.

Like this post? Please share to your friends:
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: