<div dir="ltr"><div><div><div><div>Hi David, <br><br><br></div>You could look at the generated file named &quot;cmake_install.cmake&quot; to have a better idea of what could be wrong ... <br><br></div>As a side note, there is also an issue with command like &quot;install(CODE|SCRIPT ...&quot; there are always executed first in a given directory. See [1] (Note that I couldn&#39;t find a issue in the tracker referencing that problem ... will create one if no body find it)<br>

<br></div>Hth<br></div>Jc<br><div><div><br>[1] <a href="https://github.com/Slicer/Slicer/blob/95f48d89d0806cd30b0cf58b20b7790163cec1c8/CMake/SlicerCPack.cmake#L81-86">https://github.com/Slicer/Slicer/blob/95f48d89d0806cd30b0cf58b20b7790163cec1c8/CMake/SlicerCPack.cmake#L81-86</a><br>

</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Nov 13, 2013 at 1:41 PM, David Hauck <span dir="ltr">&lt;<a href="mailto:davidh@netacquire.com" target="_blank">davidh@netacquire.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Kornel,<br>
<div class="im"><br>
On Wednesday, November 13, 2013 10:26 AM, <a href="mailto:cmake-bounces@cmake.org">cmake-bounces@cmake.org</a> wrote:<br>
&gt; Am Mittwoch, 13. November 2013 um 18:12:26, schrieb David Hauck<br>
&gt; &lt;<a href="mailto:davidh@netacquire.com">davidh@netacquire.com</a>&gt;<br>
&gt;&gt; Hello,<br>
&gt;&gt;<br>
&gt;&gt; I&#39;ve been using several &quot;install (CODE &quot;EXECUTE_PROCESS ...&quot;)&quot;<br>
&gt;&gt; constructs<br>
&gt; in my top-level CMakeLists.txt file. However, I&#39;ve been unable to<br>
&gt; capture/operate on any exit status of the embedded command.<br>
&gt; Unfortunately, documentation/searches haven&#39;t turned up any useful<br>
&gt; pointers. The closest I&#39;ve come is a pointer in the following thread:<br>
&gt;&gt; <a href="http://www.cmake.org/pipermail/cmake/2011-July/045475.html" target="_blank">http://www.cmake.org/pipermail/cmake/2011-July/045475.html</a> However,<br>
&gt;&gt; I&#39;ve not been able to sufficiently read between the lines to get this<br>
&gt;&gt; working.<br>
&gt;&gt;<br>
&gt;&gt; Does anyone have any thoughts on how to get something like the<br>
&gt;&gt; following working:<br>
&gt;&gt;<br>
&gt;&gt;    install (CODE &quot;EXECUTE_PROCESS (<br>
&gt;&gt;       COMMAND ant ...<br>
&gt;&gt;       WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/java<br>
&gt;&gt;       ERROR_VARIABLE _err<br>
&gt;<br>
&gt; Didn&#39;t you mean &#39;RESULT_VARIABLE&#39; here?<br>
<br>
</div>No, I really do mean ERROR_VARIABLE (unless, of course, this variable does not include the non-zero exit status of the EXECUTE_PROCESS command?).<br>
<br>
BTW, I&#39;m still curious about the (dual &#39;code&#39;) construct generally. Specifically, if I do the following I never see the fatal error message (so I&#39;m wondering if there&#39;s still something wrong regarding the scoping of the message command)?<br>


<div class="im"><br>
   install (CODE &quot;EXECUTE_PROCESS (<br>
      COMMAND ant ...<br>
      WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/java<br>
      ERROR_VARIABLE _err<br>
</div><div class="im">   )<br>
   MESSAGE( FATAL_ERROR \&quot;err: ${_err}\&quot;)<br>
<br>
</div>BTW, the following doesn&#39;t work either (each of the variables is empty):<br>
<div class="im"><br>
   install (CODE &quot;EXECUTE_PROCESS (<br>
      COMMAND ant ...<br>
      WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/java<br>
</div>      OUTPUT_VARIABLE _out<br>
      ERROR_VARIABLE _err<br>
      RESULT_VARIABLE _res<br>
   )<br>
   Install (CODE &quot;MESSAGE( STATUS \&quot;out: ${_out}, err: ${_err}, res: ${_res}...\&quot;)&quot;)<br>
<span class="HOEnZb"><font color="#888888"><br>
-David<br>
</font></span><div class="im HOEnZb"><br>
&gt;&gt;    )<br>
&gt;&gt;    If (${_err})<br>
&gt;&gt;       MESSAGE( FATAL_ERROR \&quot;err: ${_err}\&quot;)<br>
&gt;&gt;    endif ()&quot;)<br>
&gt;&gt; Thanks!<br>
&gt;&gt; -David<br>
&gt;&gt;<br>
&gt;       Kornel<br>
</div><div class="HOEnZb"><div class="h5">--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</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>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</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>
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><br clear="all"><br>-- <br>+1 919 869 8849<br>
</div>