将 CMake 生成的项目放在存储库中是一个好习惯吗?
如果是,要提交哪些生成的文件?例如,对于 Visaul Studio 10,是否可以仅提交 .vcxproj 文件并忽略其余文件(即 *.cmake、CMakeFiles 等)?
If yes, which of generated files to commit? For example, for Visaul Studio 10, is it OK to commit only .vcxproj files and ignore the rest (i.e. *.cmake, CMakeFiles, etc)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是个坏主意,因为 CMake 在构建之前执行构建树检查,如果您将构建树移动到另一个位置(将源代码签出到另一个目录),则会出现配置错误。
It is bad idea, because CMake performs checking of build tree before building, and if you move your build tree to another location (checkout your sources to another dir) you've got a configure error.
通常,人们只提交构建项目所需的最少文件集。有时,为了方便起见,冗余文件会进入存储库。
我从您的问题推断您使用
cmake
生成.vcxproj
文件。在这种情况下,人们通常会提交 CMakeLists 等,因为可以轻松生成其他文件。虽然我知道有些雇主希望你做相反的事情......Usually one commits only the minimal set of files needed to build the project. Sometimes redundant files get into the repository for convenience.
I deduce from your question that you use
cmake
to generate.vcxproj
files. In such situation people usually commitCMakeLists
and such, since other files can be easily generated. Though I know some employers that would want you to do exactly vice versa...不,这不是一个好的做法。我赞成 Alexey 的回答,开头是“这是个坏主意”……
CMake 存储了许多仅存在于运行配置步骤的计算机上的实体的完整路径。其生成的所有产品都应被视为仅在该计算机上有效,并且永远不会提交到在多个开发人员/计算机之间共享的存储库。
No, it is not a good practice. I upvoted Alexey's answer starting with "It is bad idea"...
CMake stores many full paths to entities that exist only on the machine where the configure step ran. All of its generated products should be considered valid only on that machine and never committed to a repository shared across multiple developers/machines.