diff options
Diffstat (limited to 'src/task_ld.cc')
-rw-r--r-- | src/task_ld.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/task_ld.cc b/src/task_ld.cc index 7710bb0..10b8bce 100644 --- a/src/task_ld.cc +++ b/src/task_ld.cc @@ -29,7 +29,8 @@ std::string readFile(const std::string &fileName) TaskLD::TaskLD(const BuildConfiguration& config, const Settings& settings, const std::string& target, - const std::vector<std::string>& objects) + const std::vector<std::string>& objects, + const std::string& sourcePath) : Task(config) , config(config) , settings(settings) @@ -40,8 +41,11 @@ TaskLD::TaskLD(const BuildConfiguration& config, target_type = TargetType::Executable; } - targetFile = settings.builddir; - targetFile /= target; + std::filesystem::path base = settings.builddir; + base /= sourcePath; + std::filesystem::create_directories(base); + + targetFile = base / target; for(const auto& object : objects) { std::filesystem::path objectFile = object; @@ -56,7 +60,7 @@ TaskLD::TaskLD(const BuildConfiguration& config, depFiles.push_back(depFile); } - flagsFile = settings.builddir / targetFile.stem(); + flagsFile = base / targetFile.stem(); flagsFile += ".flags"; source_language = Language::C; |