Hi Kornel,
On Wednesday, November 13, 2013 10:26 AM, [email protected] wrote:
> Am Mittwoch, 13. November 2013 um 18:12:26, schrieb David Hauck
> <[email protected]>
>> Hello,
>>
>> I've been using several "install (CODE "EXECUTE_PROCESS ...")"
>> constructs
> in my top-level CMakeLists.txt file. However, I've been unable to
> capture/operate on any exit status of the embedded command.
> Unfortunately, documentation/searches haven't turned up any useful
> pointers. The closest I've come is a pointer in the following thread:
>> http://www.cmake.org/pipermail/cmake/2011-July/045475.html However,
>> I've not been able to sufficiently read between the lines to get this
>> working.
>>
>> Does anyone have any thoughts on how to get something like the
>> following working:
>>
>> install (CODE "EXECUTE_PROCESS (
>> COMMAND ant ...
>> WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/java
>> ERROR_VARIABLE _err
>
> Didn't you mean 'RESULT_VARIABLE' here?
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?).
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)?
install (CODE "EXECUTE_PROCESS (
COMMAND ant ...
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/java
ERROR_VARIABLE _err
)
MESSAGE( FATAL_ERROR \"err: ${_err}\")
BTW, the following doesn't work either (each of the variables is empty):
install (CODE "EXECUTE_PROCESS (
COMMAND ant ...
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/java
OUTPUT_VARIABLE _out
ERROR_VARIABLE _err
RESULT_VARIABLE _res
)
Install (CODE "MESSAGE( STATUS \"out: ${_out}, err: ${_err}, res:
${_res}...\")")
-David
>> )
>> If (${_err})
>> MESSAGE( FATAL_ERROR \"err: ${_err}\")
>> endif ()")
>> Thanks!
>> -David
>>
> Kornel
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake