[cmake-developers] Ninja generator on Windows
Bill Hoffman
bill.hoffman at kitware.com
Tue Jan 31 14:58:33 EST 2012
On 1/31/2012 2:33 PM, Peter Kümmel wrote:
> On 31.01.2012 04:55, Bill Hoffman wrote:
>>>
>>> - Paths like 'c:\' - Ninja now supports colon escaping "c:" -> "c$:"
>>> Is there a single place where the escaping could be done?
>>
>> Can we use Posix paths in the windows ninja generator instead of windows
>> paths? I am guessing ninja would be happier with them. So, c:/, as
>> for the :, there should be a way to escape that depends on the
>> generator. I know the makefile ones have a place.
>>
>
> We can't use Posix paths. Ninja assumes ready-to-use command lines,
> on Windows this means backslashes in the generated ninja file.
> '\' is not special character, only '$' is used for escaping.
>
> 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.)
-Bill
More information about the cmake-developers
mailing list