diff options
Diffstat (limited to 'task_cc.cc')
-rw-r--r-- | task_cc.cc | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -88,6 +88,7 @@ TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings, : Task({}) , config(config) , settings(settings) + , sourceDir(sourceDir) { sourceFile = sourceDir; sourceFile /= source; @@ -193,6 +194,23 @@ int TaskCC::runInner() for(const auto& flag : compiler_flags) { + // Is arg an added include path? + if(flag.substr(0, 2) == "-I") + { + std::string include_path = flag.substr(2); + include_path.erase(0, include_path.find_first_not_of(' ')); + std::filesystem::path path(include_path); + + // Is it relative? + if(path.is_relative()) + { + path = (sourceDir / path).lexically_normal(); + std::string new_include_path = "-I" + path.string(); + args.push_back(new_include_path); + continue; + } + } + args.push_back(flag); } @@ -203,8 +221,9 @@ int TaskCC::runInner() if(settings.verbose == 0) { - std::cout << compiler() << " " << sourceFile.string() << " => " << - targetFile.string() << "\n"; + std::cout << compiler() << " " << + sourceFile.lexically_normal().string() << " => " << + targetFile.lexically_normal().string() << "\n"; } return execute(comp, args, settings.verbose > 0); } |