使用CMake与Windows 7,Visual Studio 2010和命令行 [英] Using CMake with Windows 7, Visual Studio 2010, and the command line
问题描述
如何在命令行中使用CMake与Visual Studio 2010?
How do I use CMake with Visual Studio 2010 on the command line?
使用Visual C ++ Express Edition(2010),我将输入:
With Visual C++ Express Edition (2010) I would type:
cmake .
nmake
nmake install
简单。
我注意到Visual Studio 2010,CMake生成一个解决方案文件,而不是一个Makefile。所以我键入:
I noticed with Visual Studio 2010, CMake generates a solution file instead of a Makefile. So I type:
cmake .
msbuild mysolutionfile.sln
但是什么?我以前能够输入nmake install,它会安装项目。
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?
推荐答案
两点:
1- CMake:你可以选择你的发电机。 Visual Studio恰好是您的案例中的默认值。如果要使用nmake,可以将以下内容添加到cmake命令:-GNMake Makefiles。或者,您可以使用cmake-gui.exe,第一个选项将是在下拉列表中选择您的生成器。确保删除以前生成的build dir和cmakecache。
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:可以使用/ target:INSTALL指定目标为msbuild。通常cmake创建一个INSTALL项目:构建此项目模仿运行make install。
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.
干杯。
这篇关于使用CMake与Windows 7,Visual Studio 2010和命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!