WhisperCom/projects/SelfTest/WarnAboutNoTests.cmake
Dominik Meyer 9266232d41 Squashed 'libs/Catch2/' content from commit a05a54ec
git-subtree-dir: libs/Catch2
git-subtree-split: a05a54ec25d2854b27afd38afa605fa6e3a36430
2021-08-19 17:00:44 +02:00

20 lines
528 B
CMake

# Workaround for a peculiarity where CTest disregards the return code from a
# test command if a PASS_REGULAR_EXPRESSION is also set
execute_process(
COMMAND ${CMAKE_ARGV3} -w NoTests "___nonexistent_test___"
RESULT_VARIABLE ret
OUTPUT_VARIABLE out
)
message("${out}")
if(NOT ${ret} MATCHES "^[0-9]+$")
message(FATAL_ERROR "${ret}")
endif()
if(${ret} EQUAL 0)
message(FATAL_ERROR "Expected nonzero return code")
elseif(${out} MATCHES "Helper failed with")
message(FATAL_ERROR "Helper failed")
endif()