WarnAboutNoTests.cmake 528 B

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