#include "component.h"
#include "executable.h"
#include "externaltask.h"
-#include "gnucxxcompiler.h"
+#include "gnucompiler.h"
#include "gnulinker.h"
#include "objectfile.h"
#include "sharedlibrary.h"
GnuLinker::Linker::Linker(GnuLinker &p, const string &compiler_tag):
SubTool(p)
{
- if(compiler_tag=="CC")
- command = "gcc";
- else if(compiler_tag=="CXX")
- command = "g++";
+ const Tool &compiler = builder.get_toolchain().get_tool(compiler_tag);
+ if(dynamic_cast<const GnuCompiler *>(&compiler))
+ executable = compiler.get_executable();
else
- throw invalid_argument("GnuLinker::Linker::Linker");
+ {
+ string command;
+ if(compiler_tag=="CC")
+ command = "gcc";
+ else if(compiler_tag=="CXX")
+ command = "g++";
+ else
+ throw invalid_argument("GnuLinker::Linker::Linker");
+ executable = builder.get_vfs().find_binary(command);
+ }
}
Target *GnuLinker::Linker::create_target(const list<Target *> &sources, const string &arg) const
const Binary &bin = dynamic_cast<const Binary &>(target);
vector<string> argv;
- argv.push_back(command);
+ argv.push_back(executable->get_path().str());
const Component &comp = *bin.get_component();