<br><br><div class="gmail_quote">On Fri, Jul 31, 2009 at 11:01 AM, Tyler Roscoe <span dir="ltr"><<a href="mailto:tyler@cryptio.net">tyler@cryptio.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Fri, Jul 31, 2009 at 08:42:10AM -0400, Marc Schafer wrote:<br>
> add_custom_target ( generated_messages ALL<br>
> COMMAND<br>
> ${ANT_EXECUTABLE} -f ${PROJECT_SOURCE_DIR}/java/MessageGenerator/build.xml<br>
> run<br>
> COMMAND<br>
> ${CMAKE_COMMAND} -E copy_if_different ${DICTIONARY_DIR}/c/messages.h<br>
> ${PROJECT_BINARY_DIR}/include/messages.h<br>
> )<br>
><br>
> This works fine on Linux and Mac with the make generator but does not work<br>
> on Windows XP with the Visual studio 2008 generator. From the build log<br>
> file, I can see that a batch file is getting generated with two commands:<br>
> one to run ant and the other to do the copy. When the batch file is run,<br>
> the ant command works fine, but the copy never seems to happen. My library<br>
> fails to build because it can't find messages.h even though it does exist in<br>
> ${DICTIONARY_DIR}/c/messages.h<br>
<br>
</div>I have run into this. Here's a note from our (internal) wiki:<br>
<br>
"If invoking a DOS batch file you must precede the command with the call<br>
keyword. Also, it must not have quotes surrounding the call and the<br>
command."<br>
<br>
Your ant "executable" is probably a batch file. For reasons I don't<br>
remember, VS gets confused and likes to exit immediately after running a<br>
batch file as a custom build step.</blockquote><div><br></div><div><br></div><div>This is not a VS specific problem, but rather how Windows batch files behave in general.</div><div><br></div><div>If an executable or batch file returns an error exit status, but the "call" keyword is not used in the calling batch file, then the calling batch file exits without executing the remainder of the script. Using the call keyword prevents that behavior and makes it work like you'd expect.</div>
<div><br></div><div><br></div><div>HTH,</div><div>David</div><div><br></div></div>