diff --git a/wrapper/main.cpp b/wrapper/main.cpp index e2dba8c..7bc1047 100644 --- a/wrapper/main.cpp +++ b/wrapper/main.cpp @@ -167,6 +167,11 @@ bool usegcclibstdcxx(Target &target, const char *, const char *, char **) { return true; } +bool compilerpath(Target &target, const char *, const char *path, char **) { + target.compilerpath = path; + return true; +} + bool runprog(Target &target, const char *, const char *progname, char **cargs) { auto *prog = program::getprog(progname); @@ -258,6 +263,7 @@ constexpr struct Opt { {"-icxx-isystem", checkincludepath, true, true}, {"-cxx-isystem", checkincludepath, true, true}, {"-I", checkincludepath, true, true}, + {"-foc-compiler-path", compilerpath, true, false, "="} // sets a custom path for the compiler }; bool parse(int argc, char **argv, Target &target) { diff --git a/wrapper/target.cpp b/wrapper/target.cpp index e14ddeb..81d369b 100644 --- a/wrapper/target.cpp +++ b/wrapper/target.cpp @@ -289,10 +289,15 @@ void Target::setCompilerPath() { compilerexecname += "-"; compilerexecname += compilername; } else { - if (!realPath(compilername.c_str(), compilerpath, ignoreCCACHE)) - compilerpath = compilername; + if (!compilerpath.empty()) { + compilerpath += "/"; + compilerpath += compilername; + } else { + if (!realPath(compilername.c_str(), compilerpath, ignoreCCACHE)) + compilerpath = compilername; - compilerexecname += compilername; + compilerexecname += compilername; + } } }