[cmake-developers] [PATCH] Use full path for all source files in ninja build.

Brad King brad.king at kitware.com
Tue Aug 2 13:38:15 EDT 2016


On 08/02/2016 01:08 PM, Brad King wrote:
>  Ninja: Use full path for all source files
>  https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d867f8a0

I had to revert that because it causes the Qt*Autogen tests to
fail.  Also it may break builds on Windows.

There are multiple problems:

* ConvertToNinjaPath does more than just relative path conversions.
  It also converts slashes on Windows.  Furthermore, it deals with
  CMAKE_NINJA_OUTPUT_PATH_PREFIX, though that won't matter for
  absolute paths.

* Calls to AddAssumedSourceDependencies and HasCustomCommandOutput
  later in cmNinjaTargetGenerator::WriteObjectBuildStatement expect
  to be given paths that come out of ConvertToNinjaPath.

* Ninja does not seem to be able to reconcile a dependency on
  an absolute path with a build statement providing that path
  by relative path.  Custom commands that generate source files
  list their outputs with ConvertToNinjaPath.

Basically everything assumes that all paths written as inputs
or outputs of Ninja build statements have gone through the
ConvertToNinjaPath method.  The special case for "RC" in the
existing code is likely buggy.

Ninja always uses the location of the build.ninja file as
the current working directory, so an IDE that sees a relative
path in an error message can interpret it relative to that.

-Brad



More information about the cmake-developers mailing list