summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/cmake_parse_arguments/test_utils.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-29 12:09:48 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-09-29 12:09:48 (GMT)
commit5d29506811c5b75ae48e12de6c317f6440874215 (patch)
tree5b3f133a47da91dbd8f1d74b2ae8715fb41700d6 /Tests/RunCMake/cmake_parse_arguments/test_utils.cmake
parent48cd0f74059f243d57d7032578a474452265b546 (diff)
parent66c70cd9f1eb69b03cefe7fbe8e238aaa4630f47 (diff)
downloadCMake-5d29506811c5b75ae48e12de6c317f6440874215.zip
CMake-5d29506811c5b75ae48e12de6c317f6440874215.tar.gz
CMake-5d29506811c5b75ae48e12de6c317f6440874215.tar.bz2
Merge topic 'cmake_parse_arguments-PARSE_ARGV-multi-value'
66c70cd9 cmake_parse_arguments: Add additional unit tests 41291b20 cmake_parse_arguments: Fix PARSE_ARGV multi-value argument handling
Diffstat (limited to 'Tests/RunCMake/cmake_parse_arguments/test_utils.cmake')
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/test_utils.cmake44
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()