if(MATCHES) message(SEND_ERROR "Test #1 failed") else() message(STATUS "Test #1 passed") endif() if("" MATCHES "") message(STATUS "Test #2 passed") else() message(SEND_ERROR "Test #2 failed") endif() if(MATCHES RHS) message(SEND_ERROR "Test #3 failed") else() message(STATUS "Test #3 passed") endif() set(RHS "") if(MATCHES RHS) message(SEND_ERROR "Test #4 failed") else() message(STATUS "Test #4 passed") endif() if(MATCHES "^$") message(SEND_ERROR "Test #5 failed") else() message(STATUS "Test #5 passed") endif() if("" MATCHES "^$") message(STATUS "Test #6 passed") else() message(SEND_ERROR "Test #6 failed") endif()