使用cmake生成visual studio C ++项目文件 [英] Using cmake to generate visual studio C++ project files

查看:378
本文介绍了使用cmake生成visual studio C ++项目文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个开源C ++项目,用于在Linux和Windows上编译的代码。我使用cmake在Linux上构建代码。为了易于设置和政治原因,我必须坚持Visual Studio项目文件/编辑器在Windows(我不能切换到Code :: Blocks,例如)。我看到了使用cmake生成视频工作室文件的说明,如此处

I am working on an open source C++ project, for code that compiles on Linux and Windows. I use cmake to build the code on Linux. For ease of dev-setup and political reasons, I must stick to visual studio project files/editor on Windows (I can't switch to Code::Blocks, for example). I see instructions to generate visual studio files using cmake, as here.

您以前是否使用过cmake来生成视频工作室文件?你的经验如何?假设我想向我的项目添加一个新文件。这是什么工作流程?

Have you used cmake to generate visual studio files before? How has been your experience? Suppose I want to add a new file to my project. What is the workflow for this?

推荐答案

cmake实际上是相当不错的,关键部分是windows上的每个人都要记住在加载之前运行cmake在解决方案中,我们mac端的每个人都必须记住在make之前运行它。最难的部分是作为一个Windows开发人员,确保您的结构更改是在cmakelist.txt文件中,而不是在解决方案或项目文件,因为这些更改可能会丢失,即使没有丢失也不会传递到mac端谁也需要他们,和Mac家伙将需要记住不修改make文件为同样的原因。它只需要一点思考和耐心,但首先会有错误。但是如果你使用持续集成的双方,那么这些将早日震撼,人们最终会习惯。

cmake is actually pretty good for this, the key part was everyone on the windows side has to remember to run cmake before loading in the solution, and everyone on our mac side would have to remember to run it before make. The hardest part was as a windows developer making sure your structural changes were in the cmakelist.txt file and not in the solution or project files as those changes would probably get lost and even if not lost would not get transfered over to the mac side who also needed them, and the Mac guys would need to remember not to modify the make file for the same reasons. It just requires a little thought and patience but there will be mistakes at first. But if you are using continuous integration on both sides then these will get shook out early and people will eventually get in the habit.

这篇关于使用cmake生成visual studio C ++项目文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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