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

Matějů Miroslav, Ing. Mateju.Miroslav at azd.cz
Mon Apr 18 09:30:18 EDT 2016


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<mailto:xyz at mail.com> to resolve testing problems.
​Note the message output is not for cmake but for ctest.​

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


More information about the CMake mailing list