diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2023-01-14 17:54:23 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2023-01-14 18:01:12 +0100 |
commit | 8a7f76e7a1b404dc7f703d09d724defaee9e4238 (patch) | |
tree | 6bafc5ca77048bb5ab2acf4089c38be7e32e42bd /src/tasks.cc | |
parent | ca439c62d35d587c90230894ec0d1b002ba8c639 (diff) |
Extend target_type deduction based on filename extension and move to utils.
Diffstat (limited to 'src/tasks.cc')
-rw-r--r-- | src/tasks.cc | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/tasks.cc b/src/tasks.cc index 67bed2b..b44fce8 100644 --- a/src/tasks.cc +++ b/src/tasks.cc @@ -18,6 +18,7 @@ #include "task_fn.h" #include "rebuild.h" #include "configure.h" +#include "util.h" const std::deque<Target>& getTargets(const ctor::settings& settings, bool resolve_externals) @@ -92,23 +93,9 @@ std::set<std::shared_ptr<Task>> taskFactory(const ctor::build_configuration& con { target_type = ctor::target_type::function; } - else if(targetFile.extension() == ".a") - { - target_type = ctor::target_type::static_library; - } - else if(targetFile.extension() == ".so") - { - target_type = ctor::target_type::dynamic_library; - } - else if(targetFile.extension() == "") - { - target_type = ctor::target_type::executable; - } else { - std::cerr << "Could not deduce target type from target " << - targetFile.string() << " please specify.\n"; - exit(1); + target_type = target_type_from_extension(targetFile); } } @@ -140,6 +127,12 @@ std::set<std::shared_ptr<Task>> taskFactory(const ctor::build_configuration& con // The target_type cannot be Auto break; + case ctor::target_type::unknown: + std::cerr << "Could not deduce target type from target " << + targetFile.string() << " please specify.\n"; + exit(1); + break; + case ctor::target_type::static_library: case ctor::target_type::unit_test_library: tasks.insert(std::make_shared<TaskAR>(config, settings, config.target, |