[cmake-developers] Ninja generator on Windows

Peter Collingbourne peter at pcc.me.uk
Tue Jan 31 17:58:32 EST 2012


On Tue, Jan 31, 2012 at 05:06:28PM -0500, Brad King wrote:
> On 1/31/2012 4:44 PM, Peter Kümmel wrote:
>> OK, thanks. I already noticed the usage of OutputFormat::SHELL.
>> Then I have to extend cmLocalGenerator by a Ninja case. It will be
>> similar to NMake but additionally replaces colons by '$:'.
>>
>> Should I add kwsysSystem_Shell_Flag_Ninja in System.h?
>
> Yes.  Unfortunately KWSys was not really the right place to have all
> the platform-specific shell escaping code, but it ended up that way
> historically.  Please keep any commits that touch KWSys mutually
> exclusive from commits that touch files outside KWSys.

I disagree.  The escaping rules are already implemented correctly
and are only required in the specific case where a path name needs
to appear as a (lexicographical) identifier.  Also, it is impossible
to represent certain strings as identifiers without writing some
text beforehand.  For example, the generator will build things like
this for paths containing the '@' character:

ident0 = a at b

build foo: CUSTOM_COMMAND $ident0
  [...]

Therefore, the best place to keep this code is in the part of the Ninja
generator that is responsible for writing rules/build statements to
a file.

> That will
> be handy when it comes time to integrate this work upstream because
> KWSys is shared with other projects.

Why isn't that time now?  The generator already works and passes all
tests on at least 2 platforms.

Thanks,
-- 
Peter



More information about the cmake-developers mailing list