[cmake-developers] Custom commands with Ninja on Windows

Martin Ankerl martin.ankerl at gmail.com
Thu May 19 16:31:00 EDT 2016


I didn't think about just writing a .cmd (or .bat?) with cmake, that sounds
like the simplest solution!
After each each custom command we just need to add something like this to
have the same behaviour as the &&:

if %errorlevel% neq 0 exit /b %errorlevel%

I have no experience with cmake implementation though, how would you find a
name for the filename?

Martin

On Thu, May 19, 2016 at 4:03 PM Brad King <brad.king at kitware.com> wrote:

> On 05/19/2016 01:43 AM, Martin Ankerl wrote:
> > It seems to me that there are two possible solution:
> >
> > * use a response file (rspfile and rspfile_content).
>
> Can cmd.exe /C even use a response file?  Perhaps the whole command could
> simply be written to a .cmd file instead.  I don't think our generated
> custom commands ever use ninja placeholders so we could have CMake write
> the commands to a file instead.  Ninja would only see a call to that file.
> The drawback is that we may not see the whole command from `ninja -v`.
>
> > only possible when modifying ninja to support multiline response files
>
> In what case do we end up with a multiline command?  Isn't it just
> one long command line with && chaining?
>
> > * Add a build target for each custom command, e.g. instead of
>
> It may be tricky to get the same build semantics with that approach.
>
> Thanks,
> -Brad
>
> --
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160519/0a5a05d0/attachment.html>


More information about the cmake-developers mailing list