[cmake-developers] Cannot control the name of dependfile set in Ninja generator

Brad King brad.king at kitware.com
Fri Jan 19 09:07:44 EST 2018


On 01/17/2018 04:14 PM, Claus Klein wrote:
> 1.) Is ist possible to change the object or/and the dependency file
> name generated for ninja?

No one has needed to before because currently-supported compilers all
have options to specify the output file name.

> 2.) Why generates cmake the objectname as sourcefilename.{c,cpp}.obj?

We support adding `src.c` and `src.cxx` together.  The object file
names need to be distinct.

> WindRiver sets the dep file name to objectDir/SourceName.d, so the ".obj"
> in "DEP_FILE = path/BaseName.c.obj.d" must be removed
> Armcc just uses base name in the same directory as the command runs,
> "BaseName.d".

Possible approaches to deal with this include:

* Extend the Ninja generator with settings to tell it about the above
  names.

* Set `CMAKE_<LANG>_COMPILE_OBJECT` to contain a follow-up command
  after compiling to rename the compiler-produced depfile and move
  it to where Ninja wants to see it.

Either way there could be problems with source files with the same base
name compiling at the same time and overwriting each other's depfiles.
Ideally the compilers should be fixed instead.

-Brad


More information about the cmake-developers mailing list