From c0eacf8e85003844b95e71b9004fa464d4586a38 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 14 Oct 2021 22:19:26 +0200 Subject: Use dependency system and build system for compiling ctor on config changes. --- src/task_cc.cc | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src/task_cc.cc') diff --git a/src/task_cc.cc b/src/task_cc.cc index 73297f2..e4bd7aa 100644 --- a/src/task_cc.cc +++ b/src/task_cc.cc @@ -12,6 +12,31 @@ #include "execute.h" #include "util.h" +namespace +{ +bool isClean(char c) +{ + return c != '.' && c != '/'; +} + +std::string cleanUp(const std::string& path) +{ + std::string cleaned; + for(const auto& c : path) + { + if(isClean(c)) + { + cleaned += c; + } + else + { + cleaned += '_'; + } + } + return cleaned; +} +} + TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings, const std::string& sourceDir, const Source& source) : Task(config) @@ -26,7 +51,7 @@ TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings, base /= sourceFile.parent_path(); std::filesystem::create_directories(base); - base /= config.target; + base /= cleanUp(config.target); base += "-"; base += sourceFile.stem(); -- cgit v1.2.3