Re: [cmake-developers] Custom commands with Ninja on Windows

2016-05-23 Thread Brad King
On 05/23/2016 10:24 AM, Brad King wrote: > Please use cmGeneratedFileStream. Also please place the script files in the > CMakeFiles/ directory. See cmake::GetCMakeFilesDirectoryPostSlash callers > for examples. [snip] > Please also update the call sites for PRE_BUILD, PRE_LINK, and POST_BUILD >

Re: [cmake-developers] Custom commands with Ninja on Windows

2016-05-23 Thread Brad King
On 05/23/2016 06:48 AM, Martin Ankerl wrote: > Here is an updated patch Thanks! > +#include This looks unnecessary. > +const std::string cmdFile = hasher.HashString(cmd.str()) + ".cmd"; > + > +// TODO fail if can't open file > +std::ofstream fout(cmdFile); Please use

Re: [cmake-developers] Custom commands with Ninja on Windows

2016-05-23 Thread Martin Ankerl
Thanks for the feedback! Here is an updated patch that uses a hash as filename, .cmd as extension, boolean argument, and some error checks. Martin On Fri, May 20, 2016 at 3:40 PM Brad King wrote: > On 05/20/2016 03:41 AM, Martin Ankerl wrote: > > From what I have

Re: [cmake-developers] Custom commands with Ninja on Windows

2016-05-20 Thread Brad King
On 05/20/2016 03:41 AM, Martin Ankerl wrote: > From what I have understood it seems more safe to use .bat and not > .cmd, because the behavior of the errorlevel is different. From > http://waynes-world-it.blogspot.co.at/2008/08/difference-between-bat-and-cmd.html: > >> The differences between

Re: [cmake-developers] Custom commands with Ninja on Windows

2016-05-20 Thread Martin Ankerl
sorry, that DEP_FILE problem was my fault. It's working correctly. Martin On Fri, May 20, 2016 at 9:41 AM Martin Ankerl wrote: > From what I have understood it seems more safe to use .bat and not .cmd, > because the behavior of the errorlevel is different. From >

Re: [cmake-developers] Custom commands with Ninja on Windows

2016-05-20 Thread Martin Ankerl
>From what I have understood it seems more safe to use .bat and not .cmd, because the behavior of the errorlevel is different. From http://waynes-world-it.blogspot.co.at/2008/08/difference-between-bat-and-cmd.html : > The differences between .CMD and .BAT as far as CMD.EXE is concerned are: With

Re: [cmake-developers] Custom commands with Ninja on Windows

2016-05-19 Thread Brad King
On 05/19/2016 04:31 PM, Martin Ankerl wrote: > I didn't think about just writing a .cmd (or .bat?) with cmake The ".cmd" extension is a modern version of ".bat". > that sounds like the simplest solution! Yes, assuming we never have a need for ninja placeholder substitution. Why are one-line

Re: [cmake-developers] Custom commands with Ninja on Windows

2016-05-19 Thread Martin Ankerl
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

Re: [cmake-developers] Custom commands with Ninja on Windows

2016-05-19 Thread Brad King
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

[cmake-developers] Custom commands with Ninja on Windows

2016-05-18 Thread Martin Ankerl
Hi! I've run into the same problem with many custom commands as discussed here: http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/13434 Which is referenced in this bug report: https://cmake.org/Bug/view.php?id=15612#c38924 I've had a look at this problem because this is the only

Re: [cmake-developers] Custom commands with Ninja on Windows

2015-06-15 Thread Brad King
On 06/12/2015 06:01 AM, Florent Castelli wrote: So I've been thinking that on Windows, instead of concatenating everything, we should be a script that is run using a response file that just runs all the command with error checking. Eventually, we could reuse

Re: [cmake-developers] Custom commands with Ninja on Windows

2015-06-15 Thread Florent Castelli
Alright, I'll see what I can do when I find some free time to work on this then! /Florent On Mon, Jun 15, 2015 at 3:14 PM, Brad King brad.k...@kitware.com wrote: On 06/12/2015 06:01 AM, Florent Castelli wrote: So I've been thinking that on Windows, instead of concatenating everything, we

Re: [cmake-developers] Custom commands with Ninja on Windows

2015-06-13 Thread Tim Blechmann
I'm having some issues with Ninja on Windows with long custom commands (or actually a long succession of short commands appended to the same target). The problem is that they get concatenated in one single command usingand it is pretty easy to go over the 8k command line size limit on

[cmake-developers] Custom commands with Ninja on Windows

2015-06-12 Thread Florent Castelli
Hi! I'm having some issues with Ninja on Windows with long custom commands (or actually a long succession of short commands appended to the same target). The problem is that they get concatenated in one single command using and it is pretty easy to go over the 8k command line size limit on