To produce an error from an install(CODE snippet, simply add:<div><br></div><div> if(error)</div><div> message(FATAL_ERROR \"error message here\")</div><div> endif()</div><div><br></div><div>inside the CODE based on some other "error" flag also in your CODE...</div>
<div><br><br><div class="gmail_quote">On Wed, Jul 20, 2011 at 7:45 AM, Marcel Loose <span dir="ltr"><<a href="mailto:loose@astron.nl">loose@astron.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Jc,<br>
<br>
Thanks for the tip. It makes sense to let the build fail early (i.e.<br>
during compilation, instead of installation). I'll take it into<br>
consideration.<br>
<br>
Regards,<br>
<font color="#888888">Marcel Loose.<br>
</font><div><div></div><div class="h5"><br>
On Wed, 2011-07-20 at 06:41 -0400, Jean-Christophe Fillion-Robin wrote:<br>
> Hi Marcel,<br>
><br>
> Aware I won't be answering your question regarding the exit code<br>
> associated with INSTALL(CODE ...), I still would like to suggest you<br>
> an approach that could help you addressing your issue.<br>
><br>
> What about byte-compiling the python source at build time ? In that<br>
> case, the build step would fail instead ...<br>
><br>
> You could look at macro like this one to help you: See<br>
><br>
<a href="https://github.com/commontk/CTK/blob/master/CMake/ctkMacroCompilePythonScript.cmake" target="_blank">https://github.com/commontk/CTK/blob/master/CMake/ctkMacroCompilePythonScript.cmake</a><br>
><br>
> Hth<br>
> Jc<br>
><br>
> On Wed, Jul 20, 2011 at 3:47 AM, Marcel Loose <<a href="mailto:loose@astron.nl">loose@astron.nl</a>> wrote:<br>
> Hi all,<br>
><br>
> I have a macro that, during install, compiles python source<br>
> files to<br>
> byte code. Sometimes, there's a syntax error in the python<br>
> source that<br>
> can be caught during compilation; i.e. during the execution of<br>
> INSTALL(CODE ...).<br>
><br>
> Is is possible to somehow fetch the exit status of commands<br>
> executed<br>
> inside INSTALL(CODE ...), so that I can let 'make install'<br>
> exit with a<br>
> non-zero exit status?<br>
><br>
> Best regards,<br>
> Marcel Loose.<br>
><br>
> --<br>
> Marcel Loose<br>
> Senior Software Engineer, Computing Group R&D, Astron, the<br>
> Netherlands<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<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>
><br>
><br>
><br>
> --<br>
> <a href="tel:%2B1%20919%20869%208849" value="+19198698849">+1 919 869 8849</a><br>
><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>
</div></div></blockquote></div><br></div>