From e9a2eb940d6de2afdb70acba1da0e5a412637906 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 8 Oct 2024 06:35:16 +0200 Subject: Add compile_commands.json to .gitignore generated by bdep-new --- bdep/new.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/bdep/new.cxx b/bdep/new.cxx index 7c0f6f5..be31121 100644 --- a/bdep/new.cxx +++ b/bdep/new.cxx @@ -1887,9 +1887,23 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args) << "*.pc" << '\n'; } + // In the future we could use the language specified for an empty + // project type to decide whether to add compile_commands.json to + // .gitignore (which only makes sense for the C and C++ languages). + // + bool cdb (true); + if (cdb) + { + if (!pkg || t != type::empty) + os << '\n'; + os << "# Compilation database." << '\n' + << "#" << '\n' + << "compile_commands.json" << '\n'; + } + // Only print the newline if anything is printed. // - if (newline && (!pkg || t != type::empty)) + if (newline && (!pkg || t != type::empty || cdb)) os << '\n'; }; -- cgit v1.1