Ninja: Use full path for all source files

This is consistent with the behavior of the Makefile generators.
Relative paths are difficult for an IDE to parse the output of a build
error.
This commit is contained in:
Chaoren Lin 2016-08-05 16:51:56 -07:00 committed by Brad King
parent ee9d4feb67
commit 955c2a630a
1 changed files with 4 additions and 3 deletions

View File

@ -305,7 +305,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
vars.RuleLauncher = "RULE_LAUNCH_COMPILE"; vars.RuleLauncher = "RULE_LAUNCH_COMPILE";
vars.CMTarget = this->GetGeneratorTarget(); vars.CMTarget = this->GetGeneratorTarget();
vars.Language = lang.c_str(); vars.Language = lang.c_str();
vars.Source = "$in"; vars.Source = "$IN_ABS";
vars.Object = "$out"; vars.Object = "$out";
vars.Defines = "$DEFINES"; vars.Defines = "$DEFINES";
vars.Includes = "$INCLUDES"; vars.Includes = "$INCLUDES";
@ -529,8 +529,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
cmSourceFile const* source, bool writeOrderDependsTargetForTarget) cmSourceFile const* source, bool writeOrderDependsTargetForTarget)
{ {
std::string const language = source->GetLanguage(); std::string const language = source->GetLanguage();
std::string const sourceFileName = std::string const sourceFileName = this->GetSourceFilePath(source);
language == "RC" ? source->GetFullPath() : this->GetSourceFilePath(source);
std::string const objectDir = std::string const objectDir =
this->ConvertToNinjaPath(this->GeneratorTarget->GetSupportDirectory()); this->ConvertToNinjaPath(this->GeneratorTarget->GetSupportDirectory());
std::string const objectFileName = std::string const objectFileName =
@ -539,6 +538,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
cmSystemTools::GetFilenamePath(objectFileName); cmSystemTools::GetFilenamePath(objectFileName);
cmNinjaVars vars; cmNinjaVars vars;
vars["IN_ABS"] = this->GetLocalGenerator()->ConvertToOutputFormat(
source->GetFullPath(), cmOutputConverter::SHELL);
vars["FLAGS"] = this->ComputeFlagsForObject(source, language); vars["FLAGS"] = this->ComputeFlagsForObject(source, language);
vars["DEFINES"] = this->ComputeDefines(source, language); vars["DEFINES"] = this->ComputeDefines(source, language);
vars["INCLUDES"] = this->GetIncludes(language); vars["INCLUDES"] = this->GetIncludes(language);