From bfbb506ff1a5e87401d4aa633f0707d1238082d0 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 10 Jul 2021 17:59:44 +0200 Subject: Print target names instead of target files when listing targets. --- libcppbuild.cc | 2 +- task.cc | 5 +++++ task.h | 1 + task_cc.cc | 5 +++++ task_cc.h | 1 + 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libcppbuild.cc b/libcppbuild.cc index 707cead..0bcbad5 100644 --- a/libcppbuild.cc +++ b/libcppbuild.cc @@ -194,7 +194,7 @@ int main(int argc, char* argv[]) { if(task->targetType() != TargetType::Object) { - std::cout << task->target() << "\n"; + std::cout << task->name() << "\n"; } } return 0; diff --git a/task.cc b/task.cc index 5a08a47..8c48543 100644 --- a/task.cc +++ b/task.cc @@ -35,6 +35,11 @@ int Task::registerDepTasks(const std::list>& tasks) return 0; } +std::string Task::name() const +{ + return config.target; +} + bool Task::dirty() { for(const auto& task : dependsTasks) diff --git a/task.h b/task.h index 8ad11c3..6e71db6 100644 --- a/task.h +++ b/task.h @@ -26,6 +26,7 @@ public: int registerDepTasks(const std::list>& tasks); + virtual std::string name() const; bool dirty(); bool ready(); int run(); diff --git a/task_cc.cc b/task_cc.cc index 845ad0e..a5fd9f0 100644 --- a/task_cc.cc +++ b/task_cc.cc @@ -113,6 +113,11 @@ TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings, } } +std::string TaskCC::name() const +{ + return target(); +} + bool TaskCC::dirtyInner() { if(!std::filesystem::exists(sourceFile)) diff --git a/task_cc.h b/task_cc.h index ff701f9..0ce4947 100644 --- a/task_cc.h +++ b/task_cc.h @@ -19,6 +19,7 @@ public: const Settings& settings, const std::string& sourceDir, const std::string& source); + std::string name() const override; bool dirtyInner() override; int runInner() override; -- cgit v1.2.3