Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using CMake with Windows 7, Visual Studio 2010, and the command line

How do I use CMake with Visual Studio 2010 on the command line?

With Visual C++ Express Edition (2010) I would type:

cmake .
nmake
nmake install

simple.

I noticed with Visual Studio 2010, CMake generates a solution file instead of a Makefile. So I type:

cmake .
msbuild mysolutionfile.sln

But then what? I used to be able to type "nmake install" and it would install the project. What do I type now to install the project?

like image 894
Jason Avatar asked Nov 18 '10 20:11

Jason


1 Answers

Two points:

1- CMake: You can choose your generator. Visual Studio happens to be the default in your case. If you want to use nmake, you can add the following to your cmake command: -G "NMake Makefiles". Alternatively, you can use cmake-gui.exe and the first option will be to choose your generator in a drop-down list. Make sure to remove your previously generated build dir and cmakecache.

2- Visual Studio: you can specify the target to msbuild with /target:INSTALL. Typically cmake creates an INSTALL project: building this project mimicks running make install.

Cheers.

like image 176
Mathieu JVL Avatar answered Sep 25 '22 00:09

Mathieu JVL