From 796cbaf3fdd8fbea96639292f67e0b606cff5e51 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 30 Jun 2021 22:00:55 +0200 Subject: Change '-l' argument (list files) to '-L' and add '-l' argument to list targets. --- libcppbuild.cc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/libcppbuild.cc b/libcppbuild.cc index 9a15880..707cead 100644 --- a/libcppbuild.cc +++ b/libcppbuild.cc @@ -47,6 +47,7 @@ int main(int argc, char* argv[]) std::vector add_files; std::vector remove_files; bool list_files{false}; + bool list_targets{false}; dg::Options opt; int key{128}; @@ -95,13 +96,20 @@ int main(int argc, char* argv[]) return 0; }); - opt.add("list", no_argument, 'l', + opt.add("list-files", no_argument, 'L', "List files in the build configurations.", [&]() { list_files = true; return 0; }); + opt.add("list-targets", no_argument, 'l', + "List targets.", + [&]() { + list_targets = true; + return 0; + }); + opt.add("configure-cmd", no_argument, key++, "Print commandline for last configure.", [&]() { @@ -180,6 +188,18 @@ int main(int argc, char* argv[]) auto tasks = getTasks(settings); + if(list_targets) + { + for(const auto& task : tasks) + { + if(task->targetType() != TargetType::Object) + { + std::cout << task->target() << "\n"; + } + } + return 0; + } + if(write_compilation_database) { std::ofstream istr(compilation_database); -- cgit v1.2.3