summaryrefslogtreecommitdiff
path: root/libcppbuild.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libcppbuild.cc')
-rw-r--r--libcppbuild.cc22
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);