diff options
author | Yegor Yefremov <yegorslists@googlemail.com> | 2025-03-30 22:37:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-30 13:37:42 -0700 |
commit | 8a7c9c971f930e043101ce2b41b7f3f75529162c (patch) | |
tree | 78819f3e4b570f1433cf71322b0007563f837a08 | |
parent | b41e066aa124b5feb428877c7a35776ce4d3035c (diff) | |
download | rneovim-8a7c9c971f930e043101ce2b41b7f3f75529162c.tar.gz rneovim-8a7c9c971f930e043101ce2b41b7f3f75529162c.tar.bz2 rneovim-8a7c9c971f930e043101ce2b41b7f3f75529162c.zip |
build: ignore out-of-source build folder #33191
Create a .gitignore file inside a build folder. This way this folder
will be ignored by git and hence, no entry in the root .gitignore is
required.
For more information see this post:
https://www.scivision.dev/cmake-auto-gitignore-build-dir/
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | CMakeLists.txt | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore index 98ec98ea72..b36b55cef5 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,6 @@ compile_commands.json /.idea/ # Build/deps dir -/build/ /.deps/ /tmp/ /.clangd/ diff --git a/CMakeLists.txt b/CMakeLists.txt index e129901f92..01462ab233 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,11 @@ include(InstallHelpers) include(PreventInTreeBuilds) include(Util) +if(NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) + # Auto-create a .gitignore in the specified "build" directory. + file(GENERATE OUTPUT .gitignore CONTENT "*") +endif() + #------------------------------------------------------------------------------- # User settings #------------------------------------------------------------------------------- |