szx
szx

Reputation: 6936

Is it a good practice to have CMake-generated projects in repository?

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)?

Upvotes: 7

Views: 2509

Answers (3)

DLRdave
DLRdave

Reputation: 14250

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.

Upvotes: 0

Alexey
Alexey

Reputation: 948

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.

Upvotes: 6

vines
vines

Reputation: 5225

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 commit CMakeLists and such, since other files can be easily generated. Though I know some employers that would want you to do exactly vice versa...

Upvotes: 2

Related Questions