[CMake] Return code from CMake script

Kent Williams nkwmailinglists at gmail.com
Fri Jun 22 14:37:38 EDT 2012


If CMake is running a script via -P, doesn't it return a non-zero
status if there's any error?

I'd think it would be sufficient to run to the end of the script if
everything works fine, but have something like

if(something_went_wrong)
  message(FATAL_ERROR "¡OH NO! ¡SUCEDIO ALGO TERRIBLE!!!")
endif(something_went_wrong)

On Fri, Jun 22, 2012 at 9:35 AM, Pere Mato Vila <Pere.Mato at cern.ch> wrote:
>
> On Jun 22, 2012, at 4:25 PM, David Cole wrote:
>
>> 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.
>
>
> I meant ctest as the one that calls the test I have declared with
> add_test(). What I have is something like this:
>
> add_test(cmake  -D...  -P myscript.cmake)
>
> 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
>
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list