Windows中的cmake和make [英] cmake and make in Windows

查看:123
本文介绍了Windows中的cmake和make的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解在Linux cmake中,make和make install可以组合在一起以产生发行版。例如:

I understand that in linux cmake, make and make install can be combined together to produce a release. For example:

cmake -DCMAKE_BUILD_TYPE=Release ..
make
make install 

但是,在Windows中,我找不到类似的命令可以完成相同的工作。通常,如果使用Visual Studio,首先要做的是建立一个.sln项目,然后编译.sln项目,最后运行INSTALL项目。是否有可能像在Linux中一样使用多个命令进行发布。非常感谢。

In windows, however, I cannot find similar commands that can do the same job. Usually, what is done is to build a .sln project first if Visual Studio is used, after that compile the .sln project and in the end run the INSTALL project. Will it be possible to make a release with several commands as it has been done in Linux. Many thanks.

推荐答案

您可以使用msbuild代替make:

You can use msbuild instead of make:

cmake -G"Visual Studio 12" ..
msbuild /P:Configuration=Release INSTALL.vcxproj

,或者您可以使用CMake的 -build 参数:

or you could use CMake's --build argument:

cmake -G"Visual Studio 12" ..
cmake --build . --target INSTALL --config Release

如果需要与等效的选项不带参数的make 命令(即 make all ),您可以将 ALL_BUILD 目标构建为很好,但这仍然是 INSTALL 目标的一部分。

If you need the equivalent of the make command with no args (i.e. make all) you would build the ALL_BUILD target as well, but this is built as part of the INSTALL target anyway.

这篇关于Windows中的cmake和make的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆