From 6ea6778f2bc20a9a1aabc30515ae014af69023a8 Mon Sep 17 00:00:00 2001 From: Yegor Yefremov Date: Tue, 25 Feb 2025 11:35:02 +0100 Subject: [PATCH] CMake: generate a .gitignore file for the build directory As soon as a configuration step is successful, a .gitignore file is created inside an out-of-source build directory. Hence, there is no need to put its name into the root .gitignore file. --- .gitignore | 1 - CMakeLists.txt | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0726b4c3c..b6e21c0c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ **/CMakeCache.txt **/CMakeFiles -build checker abi-checker diff --git a/CMakeLists.txt b/CMakeLists.txt index 621acacf1..81b80591d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,11 @@ project(FreeRDP LANGUAGES C) add_custom_target(fuzzers COMMENT "Build fuzzers") +if(NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) + # Git auto-ignore out-of-source build directory + file(GENERATE OUTPUT .gitignore CONTENT "*") +endif() + if(NOT DEFINED VENDOR) set(VENDOR "FreeRDP" CACHE STRING "FreeRDP package vendor") endif()