From 666ad1df2dc5b181a40d831c125529fe7e9bf0b4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 24 Feb 2017 10:07:18 -0500 Subject: Revert "Ninja: Use full path for all source files" This reverts commit v3.7.0-rc1~275^2 (Ninja: Use full path for all source files, 2016-08-05). Unfortunately using absolute paths can cause incorrect rebuilds due to ninja limitations. The ninja manual [1] explains: > ... using absolute paths, your depfile may result in a mixture of > relative and absolute paths. Paths used by other build rules need > to match exactly. Passing an absolute path to a source file to the compiler while using a relative path in the ninja build manifest can cause such mixture and lead to incorrect rebuilds. Simply revert the change for now. Note that there was a follow-up to the original change in commit v3.7.0-rc2~10^2 (Ninja: Fix RC language depfile generation with cmcldeps, 2016-10-13). We don't need to revert that because that change made the relevant code cleverly adapt to whatever variable we use to reference the source file. [1] https://ninja-build.org/manual.html#_deps Fixes: #16675 Issue: #13894 --- Source/cmNinjaTargetGenerator.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 46a6161..5c85dfa 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -377,7 +377,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) vars.RuleLauncher = "RULE_LAUNCH_COMPILE"; vars.CMTarget = this->GetGeneratorTarget(); vars.Language = lang.c_str(); - vars.Source = "$IN_ABS"; + vars.Source = "$in"; vars.Object = "$out"; vars.Defines = "$DEFINES"; vars.Includes = "$INCLUDES"; @@ -729,7 +729,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( cmSourceFile const* source, bool writeOrderDependsTargetForTarget) { std::string const language = source->GetLanguage(); - std::string const sourceFileName = this->GetSourceFilePath(source); + std::string const sourceFileName = + language == "RC" ? source->GetFullPath() : this->GetSourceFilePath(source); std::string const objectDir = this->ConvertToNinjaPath(this->GeneratorTarget->GetSupportDirectory()); std::string const objectFileName = @@ -738,8 +739,6 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( cmSystemTools::GetFilenamePath(objectFileName); cmNinjaVars vars; - vars["IN_ABS"] = this->GetLocalGenerator()->ConvertToOutputFormat( - source->GetFullPath(), cmOutputConverter::SHELL); vars["FLAGS"] = this->ComputeFlagsForObject(source, language); vars["DEFINES"] = this->ComputeDefines(source, language); vars["INCLUDES"] = this->GetIncludes(language); -- cgit v0.12