Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the cmake generator for Visual Studio 2019

With Visual Studio 2017, I used the generator "Visual Studio 15 2017 Win64" for cmake. After updating to Visual Studio 2019, what's the new corresponding generator?

like image 873
locke14 Avatar asked Apr 16 '19 12:04

locke14


People also ask

Does CMake work with Visual Studio 2019?

Visual Studio uses a CMake configuration file to drive CMake generation and build. CMakePresets. json is supported by Visual Studio 2019 version 16.10 or later and is the recommended CMake configuration file.

What is the CMake generator?

Introduction. A CMake Generator is responsible for writing the input files for a native build system. Exactly one of the CMake Generators must be selected for a build tree to determine what native build system is to be used.

Do I need CMake with Visual Studio?

CMake is a build tool in a special way. It can create makefiles and build them but you can also tell cmake to create a visual studio solution if you like. The same goes with external programs. They are the choice of the maintainer of the library you use and there are no standards for things like code generation.


1 Answers

from your directory where the cmakelist.txt exists. here are steps:

  1. mkdir build
  2. cd build
  3. depending upon the architecture you're using
    cmake -G "Visual Studio 16 2019" -A x64 ../"

other options are:

cmake -G "Visual Studio 16 2019" -A Win32
cmake -G "Visual Studio 16 2019" -A x64
cmake -G "Visual Studio 16 2019" -A ARM
cmake -G "Visual Studio 16 2019" -A ARM64

it will generate makefiles required and serves your purpose

furthermore, you could

devenv <nameof solutions file> /build <Debug/Release option> 

for building your project

like image 143
Amaresh Kumar Avatar answered Oct 01 '22 21:10

Amaresh Kumar