1

I have been taking a look at CMake for a while and I really like the idea of having code without cluttering projectfiles of several IDE's. There's just one thing I fail to understand:

You have your project with CMake files and each developing person generates his own project from it for his/her favourite IDE. But how do you nicely merge those things back into the general (CMake) project folder again? Or do you need to manually sync the changed files everytime again, by copying them in the general project folder again?

I hope you guys can help give me a solution to this problem!

4

1 回答 1

5

生成的项目文件是构建工件,就像目标文件一样。它们不能移植到其他系统,并且永远不应手动修改或检查到版本控制系统中。而是签入CMakeLists.txt文件。请注意,这些生成的项目文件直接引用源文件,不仅可以用于构建,还可以用于编辑源文件。

直接对项目进行更改CMakeLists.txt(例如添加新文件或链接到新库)。如果需要更改以支持某个开发环境,请仔细进行更改,并进行测试以确保您没有破坏其他环境的构建。例如,IF(WIN32)IF(UNIX)允许系统类型的基本条件。根据确切的构建工具、系统架构、库或其他文件的存在与否等,还有更多可能。

强烈建议构建“out-of-source”,这样构建工件(包括生成的项目文件)根本不会触及源代码树。这使您的源代码控制软件保持干净,并允许从同一源代码中为多个编译器进行多次构建。

于 2015-01-14T17:11:10.990 回答