[cmake-developers] [PATCH] Use full path for all source files in ninja build.
Florent Castelli
florent.castelli at gmail.com
Sat Aug 6 22:54:52 EDT 2016
I'd say that you shouldn't do this unless you have tested it extensively
with very long command lines, making sure that there is a response file
fallback if it grows too much.
There are issues in CMake already on Windows with long command lines and
having even longer ones is not going to help.
/Orphis
On 06/08/2016 01:51, Chaoren Lin via cmake-developers wrote:
> From: Chaoren Lin <chaorenl at google.com>
>
> 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.
> ---
> Source/cmNinjaTargetGenerator.cxx | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
> index 855a243..5b4a55d 100644
> --- a/Source/cmNinjaTargetGenerator.cxx
> +++ b/Source/cmNinjaTargetGenerator.cxx
> @@ -305,7 +305,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";
> + vars.Source = "$IN_ABS";
> vars.Object = "$out";
> vars.Defines = "$DEFINES";
> vars.Includes = "$INCLUDES";
> @@ -529,8 +529,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
> cmSourceFile const* source, bool writeOrderDependsTargetForTarget)
> {
> std::string const language = source->GetLanguage();
> - std::string const sourceFileName =
> - language == "RC" ? source->GetFullPath() : this->GetSourceFilePath(source);
> + std::string const sourceFileName = this->GetSourceFilePath(source);
> std::string const objectDir =
> this->ConvertToNinjaPath(this->GeneratorTarget->GetSupportDirectory());
> std::string const objectFileName =
> @@ -539,6 +538,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
> cmSystemTools::GetFilenamePath(objectFileName);
>
> cmNinjaVars vars;
> + vars["IN_ABS"] = source->GetFullPath();
> vars["FLAGS"] = this->ComputeFlagsForObject(source, language);
> vars["DEFINES"] = this->ComputeDefines(source, language);
> vars["INCLUDES"] = this->GetIncludes(language);
More information about the cmake-developers
mailing list