diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-06-30 22:00:55 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-06-30 22:00:55 +0200 |
commit | 796cbaf3fdd8fbea96639292f67e0b606cff5e51 (patch) | |
tree | 88d261ce8cf6d226ba9a2deac78c44713b8e720f /libcppbuild.cc | |
parent | b3940deda8d874f2c73ed64fadfb1de89b8f2353 (diff) |
Change '-l' argument (list files) to '-L' and add '-l' argument to list targets.
Diffstat (limited to 'libcppbuild.cc')
-rw-r--r-- | libcppbuild.cc | 22 |
1 files changed, 21 insertions, 1 deletions
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<std::string> add_files; std::vector<std::string> 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); |