1# Workaround for a peculiarity where CTest disregards the return code from a
2# test command if a PASS_REGULAR_EXPRESSION is also set
3execute_process(
4    COMMAND ${CMAKE_ARGV3} -w NoTests "___nonexistent_test___"
5    RESULT_VARIABLE ret
6    OUTPUT_VARIABLE out
7)
8
9message("${out}")
10
11if(NOT ${ret} MATCHES "^[0-9]+$")
12    message(FATAL_ERROR "${ret}")
13endif()
14
15if(${ret} EQUAL 0)
16    message(FATAL_ERROR "Expected nonzero return code")
17elseif(${out} MATCHES "Helper failed with")
18    message(FATAL_ERROR "Helper failed")
19endif()
20