Reputation: 134
Making a C++ application in Visual Studio 2019 with cmake, Visual Studio generates output in a folder called "out". However, there are some ninja build files like .ninja_deps, rules.ninja, and build.ninja.
Tried Visual Studio .gitignore from github/gitignore repository, but that only ignores .vs folder.
Which files should I ignore?
Upvotes: 2
Views: 12229
Reputation: 18243
In general, you should not need to track any generated files in your repository. You should check your CMakeLists.txt
file into your repository because this is code that you control, and it controls what is generated in out
. However, all of the CMake-generated build files or outputs placed in the out
directory generally should not need to be modified, and can be ignored from a source control perspective. These generated build files will often vary from person-to-person on your team (depending on their Visual Studio version, project location within the filesystem, preferences, etc.), so checking these files into source control can be a nightmare. Therefore, my recommendation is, just append a line to your .gitignore
file to ignore the entire out
directory:
...
# Visual Studio 2019 cache/options directory
.vs/
# Add this line
out/
In fact, the .gitignore
template file for Visual Studio already ignores several directories where generated build files are typically placed. You can simply add out/
to the end of this list to ignore the CMake-based build results as well.
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Add this line
out/
Upvotes: 4