I work on a number of code projects, some open source and some not. Many of these projects are intended to be cross-platform, most often running on either Linux (my natural habitat) or Windows and generally relying on CMake to build. Recently, I noticed that a Windows developer on one of the projects checked in
.sln files and
.vcxproj.filters files strewn about in nearly every directory.
Some of these files appear to contain things like paths that seem likely to be unique to that particular person's particular computer, which prompted the question about whether these should be added to the projects
.gitignore file or more generally excluded from version control.
The criteria I typically use for deciding whether things belong in version control:
- It is required to build one or more artifacts (including docs, source code, graphics)
- It is required to be there for other reasons (e.g.
- If it's a built artifact, it should NOT go into version control
What I've looked at
There is this question which asks about which Visual C++ file types should be checked in for a Visual C++ project. (My emphasis.) This isn't really that; the intent is actually to use CMake to create the build system, one of which could be Visual Studio. That question and most of the answers seem to assume that everyone will be using VS, which is not the case here.
I've also consulted Microsoft's docs on using CMake in Visual Studio, which seems to indicate that for a CMake project, the
.sln files, and others will either not be needed or will be regenerated if they are. For that reason, they seem to fail under criteron 1 above. On the other hand, it's common for
autotools-based projects to include things in their repositories that autotools creates so that those who rebuild from source don't need autotools.
Finally, of course, I actually spoke to the other developer who, like me, could see arguments either way. Since both of us are apparently too annoyingly collaborative to make the definitive decision in this case, I thought I'd inquire here.
.vcxproj.filtersfiles be checked in to version control for multi-platform projects?
- If so, is there a way that non-VS developers can easily omit those files to reduce clutter and distraction?
- If not, should VS developers be given any particular guidance on how to use CMake?
To be clear, I'm looking primarily for a logical rationale that we might be able to apply as policy for future projects and NOT unsupported opinion.