<div>Awesome, works. Thanks.</div>
<div> </div>
<div>#works</div>
<div>add_custom_target (anttest<br> COMMENT "this is a garbage ANT test target"</div>
<div> COMMAND "call"</div>
<div> "ant"<br>)<br><br><br></div>
<div class="gmail_quote">On Mon, Jan 30, 2012 at 6:19 PM, David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">If using nmake, try using "call ant" instead of just "ant". Using call<br>will propagate the error return result correctly, I think.<br>
<div class="HOEnZb">
<div class="h5"><br><br>On Mon, Jan 30, 2012 at 8:12 PM, Christopher Piekarski<br><<a href="mailto:polo1065@gmail.com">polo1065@gmail.com</a>> wrote:<br>> When launching "ant" using the CMake COMMAND in a add_custom_target macro<br>
> the exit status is always 0. When the same "ant" command is run from the<br>> command line with the same arguments from the same working directory the<br>> exit codes are correctly reported back to the shell.<br>
><br>> #Works, returns exit code 2<br>> add_custom_target (blah<br>> COMMENT "this is a garbage test target"<br>> COMMAND "dir"<br>> "-l"<br>> )<br>> #doesn't work, return 0 and should be 1 (like it is when run from command<br>
> line)<br>> add_custom_target (anttest<br>> COMMENT "this is a garbage ANT test target"<br>> COMMAND "ant"<br>> )<br>><br>> The following is the output from 3 different shell commands. By inspecting<br>
> the command and the result output you can see the discrepancy.<br>><br>> C:\Users\Chris\\build\cross-platform>nmake blah<br>> Microsoft (R) Program Maintenance Utility Version <a href="tel:9.00.30729.01" value="+19003072901">9.00.30729.01</a><br>
> Copyright (C) Microsoft Corporation. All rights reserved.<br>> [ 0%] this is a garbage test target<br>> Volume in drive C has no label.<br>> Volume Serial Number is 72F0-29DB<br>> Directory of C:\Users\Chris\build\cross-platform<br>
> File Not Found<br>> NMAKE : fatal error U1077: 'dir' : return code '0x1'<br>> Stop.<br>> NMAKE : fatal error U1077:<br>> 'T:\HOST__i686-pc-windows\x86_64-pc-windows-msvc2008\<br>> bin\nmake.exe' : return code '0x2'<br>
> Stop.<br>> NMAKE : fatal error U1077:<br>> 'T:\HOST__i686-pc-windows\x86_64-pc-windows-msvc2008\<br>> bin\nmake.exe' : return code '0x2'<br>> Stop.<br>> NMAKE : fatal error U1077:<br>> 'T:\HOST__i686-pc-windows\x86_64-pc-windows-msvc2008\<br>
> bin\nmake.exe' : return code '0x2'<br>> Stop.<br>> C:\Users\Chris\build\cross-platform>echo %ERRORLEVEL%<br>> 2<br>><br>><br>> C:\Users\Chris\rebit_bogus6\build\cross-platform>nmake anttest<br>
> Microsoft (R) Program Maintenance Utility Version <a href="tel:9.00.30729.01" value="+19003072901">9.00.30729.01</a><br>> Copyright (C) Microsoft Corporation. All rights reserved.<br>> [ 0%] this is a garbage ANT test target<br>
> Buildfile: build.xml does not exist!<br>> Build failed<br>> [100%] Built target anttest<br>> C:\Users\Chris\build\cross-platform>echo %ERRORLEVEL%<br>> 0<br>><br>> C:\Users\Chris\build\cross-platform>ant<br>
> Buildfile: build.xml does not exist!<br>> Build failed<br>> C:\Users\Chris\build\cross-platform>echo %ERRORLEVEL%<br>> 1<br>><br>><br>> Any thoughts?<br>><br>> Thanks,<br>> Chris<br>><br>
><br></div></div><span class="HOEnZb"><font color="#888888">> --<br>><br>> Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>><br>> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>><br>> Please keep messages on-topic and check the CMake FAQ at:<br>> <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
><br>> Follow this link to subscribe/unsubscribe:<br>> <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></font></span></blockquote></div><br>