summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope.cmake')
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope.cmake49
1 files changed, 49 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope.cmake b/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope.cmake
new file mode 100644
index 0000000..87c968a
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope.cmake
@@ -0,0 +1,49 @@
+set(FOO BAR)
+
+cmake_policy(SET CMP0054 NEW)
+
+foreach(loop_var arg1 arg2)
+ if(NOT FOO STREQUAL BAR)
+ message(FATAL_ERROR "The variable should match the string")
+ endif()
+
+ if("FOO" STREQUAL BAR)
+ message(FATAL_ERROR "The strings should not match")
+ endif()
+
+ cmake_policy(SET CMP0054 OLD)
+
+ if(NOT FOO STREQUAL BAR)
+ message(FATAL_ERROR "The variable should match the string")
+ endif()
+
+ if(NOT "FOO" STREQUAL BAR)
+ message(FATAL_ERROR "The quoted variable should match the string")
+ endif()
+
+ cmake_policy(SET CMP0054 NEW)
+endforeach()
+
+cmake_policy(SET CMP0054 OLD)
+
+foreach(loop_var arg1 arg2)
+ if(NOT FOO STREQUAL BAR)
+ message(FATAL_ERROR "The variable should match the string")
+ endif()
+
+ if(NOT "FOO" STREQUAL BAR)
+ message(FATAL_ERROR "The quoted variable should match the string")
+ endif()
+
+ cmake_policy(SET CMP0054 NEW)
+
+ if(NOT FOO STREQUAL BAR)
+ message(FATAL_ERROR "The variable should match the string")
+ endif()
+
+ if("FOO" STREQUAL BAR)
+ message(FATAL_ERROR "The strings should not match")
+ endif()
+
+ cmake_policy(SET CMP0054 OLD)
+endforeach()