cmake和视觉工作室 [英] cmake and visual studio

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

问题描述

gcc 4.4.2 / Visual Studio C ++ 2008

gcc 4.4.2 / Visual Studio C++ 2008

我一直在Linux上使用cmake,没有任何问题。

I have been using cmake on linux, without any problems.

现在我已经由应用程序移植到了Windows上。

Now I have ported by application to run on windows.

我使用cmake -G Visual Studio 9 2008 ../ src

I generated the solution files using cmake -G "Visual Studio 9 2008 ../src"

但是,我知道cmake只会创建一个Makefile,编译器会使用它来构建您的应用程序。

However, I know that cmake only creates a Makefile that is used by the compiler to build your application.

我在Visual Studio中打开解决方案,然后按F7键进行编译。

I open my solution in Visual Studio, I press the F7 key to compile.

我想知道它是否真的使用了由cmake生成的Makefile?还是像任何普通的Visual Studio程序一样正在编译应用程序?

I am wondering does it actually use the Makefile that was generated by cmake? Or it is just compiling the application like any normal visual studio program?

非常感谢您的建议,

推荐答案

Cmake生成Visual Studio解决方案和项目文件。

Cmake generates a Visual Studio Solution and Project file.

该解决方案至少包含三个项目:

The solution contains at least three projects:


  • ALL_BUILD

  • YourProject

  • ZERO_CHECK

设置了解决方案,以便在您构建项目(通过构建解决方案或构建项目)时,将构建 YourProject,然后将构建ZERO_CHECK,从而导致cmake运行并检查是否有任何更改。如果有任何更改,将重新生成解决方案和项目文件,Visual Studio会询问您是否要重新加载。

The solution is set up so that when you build your project (by build solution, or build project) "YourProject" will be built and then ZERO_CHECK will be built, causing cmake to run and check if anything has changed. If anything has changed, the solution and project file will be regenerated and Visual Studio will ask if you would like to reload.

程序的编译由Visual Studio完成。 ,就像您手动设置它一样,但是Visual Studio将运行cmake,从而检查是否有任何更改,并且应重新生成项目文件。

The compilation of your program is done by Visual Studio, as it would if you set it up manually, but Visual Studio will run cmake, and thus check if anything has changed, and the project files should be regenerated.

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

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