[Cmake-commits] [cmake-commits] king committed CMakeLists.txt 1.26 1.27

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Mar 17 15:10:17 EDT 2009


Update of /cvsroot/CMake/CMake/Tests/StringFileTest
In directory public:/mounts/ram/cvs-serv11323/Tests/StringFileTest

Modified Files:
	CMakeLists.txt 
Log Message:
ENH: New foreach(<var> IN ...) mode

This creates a new mode of the foreach command which allows precise
iteration even over empty elements.  This mode may be safely extended
with more keyword arguments in the future.  The cost now is possibly
breaking scripts that iterate over a list of items beginning with 'IN',
but there is no other way to extend the syntax in a readable way.


Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/StringFileTest/CMakeLists.txt,v
retrieving revision 1.26
retrieving revision 1.27
diff -C 2 -d -r1.26 -r1.27
*** CMakeLists.txt	17 Dec 2008 13:24:35 -0000	1.26
--- CMakeLists.txt	17 Mar 2009 19:10:15 -0000	1.27
***************
*** 218,219 ****
--- 218,238 ----
  TEST_RANGE("3;10;2" "3;5;7;9")
  TEST_RANGE("10;0;-3" "10;7;4;1")
+ 
+ # Test FOREACH IN signature
+ set(list1 "" a "")
+ set(list2 a "" b)
+ set(var_)
+ set(var_a)
+ set(var_b)
+ foreach(item IN LISTS list1 list2 ITEMS "" a "")
+   set(var_${item} "${var_${item}}x")
+ endforeach(item)
+ if(NOT "${var_}" STREQUAL "xxxxx")
+   message(FATAL_ERROR "count incorrect for \"\": [${var_}]")
+ endif()
+ if(NOT "${var_a}" STREQUAL "xxx")
+   message(FATAL_ERROR "count incorrect for \"a\": [${var_a}]")
+ endif()
+ if(NOT "${var_b}" STREQUAL "x")
+   message(FATAL_ERROR "count incorrect \"b\": [${var_b}]")
+ endif()



More information about the Cmake-commits mailing list