From 14d1d035cc48307943e587c513effa2aeab0b64c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=92=80=E5=A2=83=E7=9F=B3?= Date: Tue, 21 Apr 2026 22:56:46 +0800 Subject: [PATCH] [cmake] Add a .gitignore file to build directory (inspired by Meson) (#5957) --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba65857c6..7c92039d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,10 @@ Before that, remove the files created by this failed run with" rm -rf CMakeCache.txt CMakeFiles") endif () +# Add a .gitignore file to build directory (inspired by Meson) +if (NOT ("${PROJECT_BINARY_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}") AND NOT (EXISTS "${PROJECT_BINARY_DIR}/.gitignore")) + file(WRITE "${PROJECT_BINARY_DIR}/.gitignore" "*") +endif () ## HarfBuzz build configurations option(HB_HAVE_CAIRO "Enable cairo interop helpers" OFF)