[CMake] CMakeLists.txt: How to print a message if ctest fails?

Muhammad Osama osama94 at gmail.com
Mon Apr 18 14:33:04 EDT 2016


Hi Miroslav,

Thank you for replying! I added this in my root CMakeLists.txt, purposely
made the ctest's test fail but didn't get the output message.
Is this script suppose to be added inside CMakeLists.txt? Or am I doing
this incorrectly?

Thanks again,

On Mon, Apr 18, 2016 at 6:30 AM, Matějů Miroslav, Ing. <
Mateju.Miroslav at azd.cz> wrote:

> Hi Muhammad,
>
> you can use a CTest script, see
> https://cmake.org/Wiki/CMake_Scripting_Of_CTest for details. I use the
> following code in my CTest script:
>
>
>
> if(configure_failed OR build_failed OR test_failed)
>
>     message(FATAL_ERROR "Test ${CTEST_BUILD_NAME} failed.")
>
> endif()
>
>
>
> Best regards,
>
> Miroslav
>
>
>
> *From:* CMake [mailto:cmake-bounces at cmake.org] *On Behalf Of *Muhammad
> Osama
> *Sent:* Friday, April 15, 2016 8:53 PM
> *To:* cmake at cmake.org
> *Subject:* [CMake] CMakeLists.txt: How to print a message if ctest fails?
>
>
>
> Is there a way I can setup CMakeLists.txt to print a message if ctest
> tests fail? For example:
>
> cmake ..
> make
> ctest // fails
> message output: Please contact xyz at mail.com to resolve testing problems.
>
> ​Note the message output is not for cmake but for ctest.​
>
>
>
> --​​
>
> Muhammad
>



-- 
*Muhammad*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160418/61cae1a0/attachment.html>


More information about the CMake mailing list