diff options
Diffstat (limited to 'task_ld.cc')
-rw-r--r-- | task_ld.cc | 26 |
1 files changed, 12 insertions, 14 deletions
@@ -2,14 +2,10 @@ #include <iostream> #include <fstream> -#include <unistd.h> -#include <cstring> -#include <sys/types.h> -#include <sys/wait.h> -#include <spawn.h> #include "libcppbuild.h" #include "settings.h" +#include "execute.h" TaskLD::TaskLD(const BuildConfiguration& config, const Settings& settings, @@ -22,8 +18,6 @@ TaskLD::TaskLD(const BuildConfiguration& config, targetFile /= target; for(const auto& object : objects) { - //std::filesystem::path objectFile = settings.builddir; - //objectFile /= object; std::filesystem::path objectFile = object; objectFiles.push_back(objectFile); } @@ -60,15 +54,19 @@ int TaskLD::run() objectlist += std::string(objectFile); } - std::string compiler = "g++ " + objectlist + " " + - config.ldflags + " " + - "-o " + std::string(targetFile); - std::cout << compiler << "\n"; - if(system(compiler.data())) + std::vector<std::string> args; + for(const auto& objectFile : objectFiles) { - return 1; + args.push_back(std::string(objectFile)); } - return 0; + for(const auto& flag : config.ldflags) + { + args.push_back(flag); + } + args.push_back("-o"); + args.push_back(std::string(targetFile)); + + return execute("/usr/bin/g++", args); } int TaskLD::clean() |