diff options
Diffstat (limited to 'Tests/RunCMake/cmake_parse_arguments/test_utils.cmake')
-rw-r--r-- | Tests/RunCMake/cmake_parse_arguments/test_utils.cmake | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/Tests/RunCMake/cmake_parse_arguments/test_utils.cmake b/Tests/RunCMake/cmake_parse_arguments/test_utils.cmake index f5425c2..9ce99b8 100644 --- a/Tests/RunCMake/cmake_parse_arguments/test_utils.cmake +++ b/Tests/RunCMake/cmake_parse_arguments/test_utils.cmake @@ -1,20 +1,30 @@ -macro(TEST variable) - SET(expected "${ARGN}") - if ( "${expected}" STREQUAL "UNDEFINED" ) - if (DEFINED ${variable}) - message(FATAL_ERROR "'${variable}' shall be undefined but has value '${${variable}}'") - endif() - elseif( "${expected}" STREQUAL "FALSE" ) - if (NOT ${variable} STREQUAL "FALSE") - message(FATAL_ERROR "'${variable}' shall be FALSE") - endif() - elseif( "${expected}" STREQUAL "TRUE" ) - if (NOT ${variable} STREQUAL "TRUE") - message(FATAL_ERROR "'${variable}' shall be TRUE") - endif() +function(TEST variable) + if(ARGC GREATER 2) + set(i 0) + foreach(value IN LISTS ${variable}) + math(EXPR j "${i} + 1") + set(${variable}[${i}] "${value}") + TEST(${variable}[${i}] "${ARGV${j}}") + set(i ${j}) + endforeach() else() - if (NOT ${variable} STREQUAL "${expected}") - message(FATAL_ERROR "'${variable}' shall be '${expected}'") + set(expected "${ARGN}") + if("${expected}" STREQUAL "UNDEFINED") + if(DEFINED ${variable}) + message(FATAL_ERROR "'${variable}' shall be undefined but has value '${${variable}}'") + endif() + elseif("${expected}" STREQUAL "FALSE") + if(NOT ${variable} STREQUAL "FALSE") + message(FATAL_ERROR "'${variable}' shall be FALSE") + endif() + elseif("${expected}" STREQUAL "TRUE") + if(NOT ${variable} STREQUAL "TRUE") + message(FATAL_ERROR "'${variable}' shall be TRUE") + endif() + else() + if(NOT ${variable} STREQUAL "${expected}") + message(FATAL_ERROR "'${variable}' shall be '${expected}'") + endif() endif() endif() -endmacro() +endfunction() |