[CMake] INSTALL CODE Error Results and Termination
Kornel Benko
kornel at lyx.org
Wed Nov 13 14:08:12 EST 2013
Am Mittwoch, 13. November 2013 um 18:41:03, schrieb David Hauck <davidh at netacquire.com>
> Hi Kornel,
>
> On Wednesday, November 13, 2013 10:26 AM, cmake-bounces at cmake.org wrote:
> > Am Mittwoch, 13. November 2013 um 18:12:26, schrieb David Hauck
> > <davidh at netacquire.com>
> >> 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?).
If you run 'cmake --help-command execute_process', you see:
...
If RESULT_VARIABLE is given the variable will be set to contain the
result of running the processes. This will be an integer return code
from the last child or a string describing an error condition.
...
So, if this is not "0", then you have an error condition.
> 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}\")
Never did this. When do you want to see the message?
As I understand your code, only in call of cmake, e.g. at configuration time.
Kornel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20131113/fb21f332/attachment.pgp>
More information about the CMake
mailing list