Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure CMake version in Visual Studio 2019

Is there a way to configure the Visual Studio 2019 integrated CMake version? There are features in the latest CMake version that I would like to use, but I'm forced to build from the command line in this case. If I build from the VS IDE, the CMake version used is the Visual Studio-integrated one. I would like to change it if possible.

like image 204
marcks Avatar asked Nov 08 '19 21:11

marcks


People also ask

How do I run CMake in Visual Studio?

Running CMake for Windows / Microsoft Visual C++ (MSVC) Run cmake-gui.exe, which should be in your Start menu under Program Files, there may also be a shortcut on your desktop, or if you built from source, it will be in the build directory.

How do I specify CMake generator?

CMake Generators are platform-specific so each may be available only on certain platforms. The cmake(1) command-line tool --help output lists available generators on the current platform. Use its -G option to specify the generator for a new build tree.

Where is CMake settings editor?

To open the CMake settings editor, select the Configuration drop-down in the main toolbar and choose Manage Configurations. Now you see the Settings Editor with the installed configurations on the left.

How do I add CMake to PATH in Visual Studio?

To run an explicitely installed CMake you should download a CMake suitable for your platform from https://cmake.org/download install it and add the bin folder of the installation directory to your PATH variable, e.g. set PATH=C:\Program Files\CMake\bin;%PATH% on Windows.


1 Answers

You can download the latest CMake from here to your system. To point Visual Studio to this latest version, you have to edit your CMakeSettings.json file. You must change the value of the cmakeExecutable option to the installed location of the latest CMake version.

CMakeSettings.json:

  ...
  "cmakeExecutable": "C:/path/to/new/cmake/executable",
  ...
like image 71
Kevin Avatar answered Sep 17 '22 23:09

Kevin