[CMake] Return code from CMake script

David Cole david.cole at kitware.com
Fri Jun 22 10:25:18 EDT 2012


On Fri, Jun 22, 2012 at 10:15 AM, Pere Mato Vila <Pere.Mato at cern.ch> wrote:

>  Thanks very much for you prompt answer.
>
>
>  As an alternative (workaround), perhaps you could write the status value
> into a file that you inspect after CMake returns?
>
>
>  Unfortunately this is not possible because who calls by script is ctest.
>
>
>
Then it should definitely be possible.

Before calling "message(FATAL_ERROR" write out a file with "file(WRITE" to
indicate the return value that you want.

Then after the script is done (or after ctest_configure if you're producing
the FATAL_ERROR in a CMakeLists), use "file(READ" in the ctest script to
read the file that has the return value in it.

This may or may not be "too much effort" for what you're trying to do, but
it should certainly be possible...


HTH,
David



>
>  Cheers,
>
>  Pere
>
>  -------------------------------------------------------------
>  Pere Mato  CERN, PH Department, CH 1211 Geneva 23, Switzerland
>            e-mail: pere.mato at cern.ch      tel: +41 22 76 78696
>            fax:  +41 22 76 68792            gsm: +41 76 48 70855
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120622/423feac6/attachment-0001.htm>


More information about the CMake mailing list