<div dir="ltr"><div><div><div><div>Hi David, <br><br><br></div>You could look at the generated file named "cmake_install.cmake" 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 "install(CODE|SCRIPT ..." there are always executed first in a given directory. See [1] (Note that I couldn'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"><<a href="mailto:davidh@netacquire.com" target="_blank">davidh@netacquire.com</a>></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>
> Am Mittwoch, 13. November 2013 um 18:12:26, schrieb David Hauck<br>
> <<a href="mailto:davidh@netacquire.com">davidh@netacquire.com</a>><br>
>> Hello,<br>
>><br>
>> I've been using several "install (CODE "EXECUTE_PROCESS ...")"<br>
>> constructs<br>
> in my top-level CMakeLists.txt file. However, I've been unable to<br>
> capture/operate on any exit status of the embedded command.<br>
> Unfortunately, documentation/searches haven't turned up any useful<br>
> pointers. The closest I've come is a pointer in the following thread:<br>
>> <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>
>> I've not been able to sufficiently read between the lines to get this<br>
>> working.<br>
>><br>
>> Does anyone have any thoughts on how to get something like the<br>
>> following working:<br>
>><br>
>> install (CODE "EXECUTE_PROCESS (<br>
>> COMMAND ant ...<br>
>> WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/java<br>
>> ERROR_VARIABLE _err<br>
><br>
> Didn't you mean 'RESULT_VARIABLE' 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'm still curious about the (dual 'code') construct generally. Specifically, if I do the following I never see the fatal error message (so I'm wondering if there's still something wrong regarding the scoping of the message command)?<br>
<div class="im"><br>
install (CODE "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 \"err: ${_err}\")<br>
<br>
</div>BTW, the following doesn't work either (each of the variables is empty):<br>
<div class="im"><br>
install (CODE "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 "MESSAGE( STATUS \"out: ${_out}, err: ${_err}, res: ${_res}...\")")<br>
<span class="HOEnZb"><font color="#888888"><br>
-David<br>
</font></span><div class="im HOEnZb"><br>
>> )<br>
>> If (${_err})<br>
>> MESSAGE( FATAL_ERROR \"err: ${_err}\")<br>
>> endif ()")<br>
>> Thanks!<br>
>> -David<br>
>><br>
> 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>