[cmake-developers] Ninja generator on Windows

Peter Kümmel syntheticpp at gmx.net
Tue Jan 31 16:44:44 EST 2012


>> Therefore the question, if there is a single place where
>> all the slashes could be replaced by backslashes before we write
>> them down to the ninja file.
>>
>
> All of that is done in the cmLocalGenerator for the NMake and Jom
> generators that use windows paths:
>
>
>     enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT };
>     enum OutputFormat { UNCHANGED, MAKEFILE, SHELL, RESPONSE };
>     std::string ConvertToOutputFormat(const char* source, OutputFormat
> output);
>     std::string Convert(const char* remote, RelativeRoot local,
>                         OutputFormat output = UNCHANGED,
>                         bool optional = false);
>     std::string Convert(RelativeRoot remote, const char* local,
>                         OutputFormat output = UNCHANGED,
>                         bool optional = false);
>
>
> So, you want to make sure Convert is used, and it should do the right
> thing.  That eventually calls:
>
>
> std::string cmSystemTools::ConvertToOutputPath(const char* path)
>
> Which will use windows paths, unless s_ForceUnixPaths is set (used by
> unix makefile generator on windows.)
>

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?

And isn't there some code which then should be moved into cmLocalGenerator,
maybe EncodeIdent?

Peter





More information about the cmake-developers mailing list