Presently, there is no way to do that. It would be a reasonable feature request to add an "EXIT_STATUS" or "EXIT_CODE" parameter to the message command to enable this functionality.<div><br></div><div>As an alternative (workaround), perhaps you could write the status value into a file that you inspect after CMake returns?</div>
<div><br></div><div><br></div><div>HTH,</div><div>David</div><div><br><br><div class="gmail_quote">On Fri, Jun 22, 2012 at 9:24 AM, Pere Mato Vila <span dir="ltr"><<a href="mailto:Pere.Mato@cern.ch" target="_blank">Pere.Mato@cern.ch</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Perhaps this is a trivial question. Is there a way to return a specific error code from a CMake script ( -P <file> option)? The only way I know to return a failure is by calling message(FATAL_ERROR ...) and this returns rc = 1, but I would like to return the error I got from the underlying process execution.<br>
Cheers,<br>
<br>
<br>
Pere<br>
<br>
-------------------------------------------------------------<br>
Pere Mato CERN, PH Department, CH 1211 Geneva 23, Switzerland<br>
e-mail: <a href="mailto:pere.mato@cern.ch">pere.mato@cern.ch</a> tel: <a href="tel:%2B41%2022%2076%2078696" value="+41227678696">+41 22 76 78696</a><br>
fax: <a href="tel:%2B41%2022%2076%2068792" value="+41227668792">+41 22 76 68792</a> gsm: <a href="tel:%2B41%2076%2048%2070855" value="+41764870855">+41 76 48 70855</a><br>
<br>
<br>
--<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 <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: <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>
</blockquote></div><br></div>