<div>When launching "ant" using the CMake COMMAND in a add_custom_target macro the exit status is always 0. When the same "ant" command is run from the command line with the same arguments from the same working directory the exit codes are correctly reported back to the shell.</div>
<div> </div>
<div>#Works, returns exit code 2<br>add_custom_target (blah<br> COMMENT "this is a garbage test target"<br> COMMAND "dir"<br> "-l"<br>)</div>
<div>#doesn't work, return 0 and should be 1 (like it is when run from command line)<br>add_custom_target (anttest<br> COMMENT "this is a garbage ANT test target"<br> COMMAND "ant"<br>)</div>
<div> </div>
<div>The following is the output from 3 different shell commands. By inspecting the command and the result output you can see the discrepancy. </div>
<div> </div>
<div>C:\Users\Chris\\build\cross-platform><strong>nmake blah</strong></div>
<div>Microsoft (R) Program Maintenance Utility Version 9.00.30729.01<br>Copyright (C) Microsoft Corporation. All rights reserved.</div>
<div>[ 0%] this is a garbage test target<br> Volume in drive C has no label.<br> Volume Serial Number is 72F0-29DB</div>
<div> Directory of C:\Users\Chris\build\cross-platform</div>
<div>File Not Found<br><strong>NMAKE : fatal error U1077: 'dir' : return code '0x1'<br></strong>Stop.<br>NMAKE : fatal error U1077: 'T:\HOST__i686-pc-windows\x86_64-pc-windows-msvc2008\<br>bin\nmake.exe' : return code '0x2'<br>
Stop.<br>NMAKE : fatal error U1077: 'T:\HOST__i686-pc-windows\x86_64-pc-windows-msvc2008\<br>bin\nmake.exe' : return code '0x2'<br>Stop.<br>NMAKE : fatal error U1077: 'T:\HOST__i686-pc-windows\x86_64-pc-windows-msvc2008\<br>
bin\nmake.exe' : return code '0x2'<br>Stop.</div>
<div>C:\Users\Chris\build\cross-platform>echo %ERRORLEVEL%<br><strong>2</strong></div>
<div> </div>
<div> </div>
<div>C:\Users\Chris\rebit_bogus6\build\cross-platform><strong>nmake anttest</strong></div>
<div>Microsoft (R) Program Maintenance Utility Version 9.00.30729.01<br>Copyright (C) Microsoft Corporation. All rights reserved.</div>
<div>[ 0%] this is a garbage ANT test target<br>Buildfile: build.xml does not exist!<br><strong>Build failed<br></strong>[100%] Built target anttest</div>
<div>C:\Users\Chris\build\cross-platform>echo %ERRORLEVEL%<br><strong>0</strong></div>
<div><strong></strong> </div>
<div>C:\Users\Chris\build\cross-platform><strong>ant<br></strong>Buildfile: build.xml does not exist!<br><strong>Build failed<br></strong>C:\Users\Chris\build\cross-platform>echo %ERRORLEVEL%<br><strong>1</strong></div>
<div> </div>
<div> </div>
<div>Any thoughts?</div>
<div> </div>
<div>Thanks,</div>
<div>Chris</div>
<div> </div>