[cmake-developers] Ninja generator on Windows

Peter Collingbourne peter at pcc.me.uk
Tue Jan 31 10:19:51 EST 2012


On Tue, Jan 31, 2012 at 12:15:59AM +0100, Peter Kümmel wrote:
> I played a bit with the Ninja generator on Windows,
> and added some hacks to make it a bit running:
>
> https://github.com/syntheticpp/CMake/commit/0a55b61271106eb7c3319340f2c54f6bab3c0f8b
>
> Here are the problems I found so far:
>
> - Paths like 'c:\' - Ninja now supports colon escaping "c:" -> "c$:"
>   Is there a single place where the escaping could be done?

':' only needs to be escaped in identifiers.  So
cmGlobalNinjaGenerator::EncodeIdent is the correct place.

I don't think your changes to that function are correct though.
The old code would have correctly "escaped" colons by placing them in a
variable -- perhaps it could be made smarter by doing the replacement
if the only non-identifier character in the string is ':' (or ' '
or some other ident-escapable characters).

> - Finding the msvc compiler fails because TARGET_IMPLIB is empty
>   and to the linker /implib: is passed without an argument.
>   Why is TARGET_IMPLIB empty?

Probably because cmLocalGenerator::TargetImplib is not being
set.  Look at how the makefile generator does it.

> - Some targets have the .exe extension, but the rule misses the .exe.

Can you show an example of what you mean?  The generator should be
using cmTarget::GetFullPath to build paths to targets which seems
to append CMAKE_EXECUTABLE_SUFFIX (i.e. ".exe" on Windows) where
necessary.

> - When && is used for calling multiple command a 'cmd.exe /c' call is necessary.

Correct.  That will need to be prepended in
cmLocalNinjaGenerator::BuildCommandLine if the vector contains more
than one command.

Thanks,
-- 
Peter



More information about the cmake-developers mailing list