aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-10-08 06:35:16 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-10-08 06:35:16 +0200
commite9a2eb940d6de2afdb70acba1da0e5a412637906 (patch)
tree0c831ec8a22f9fac05134550efb5573319c33aee
parent9771466fc4f95df639e76c8bd511856c4300af02 (diff)
Add compile_commands.json to .gitignore generated by bdep-newHEADmaster
-rw-r--r--bdep/new.cxx16
1 files changed, 15 insertions, 1 deletions
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';
};