summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CMP0054
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/CMP0054')
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-NEW-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-NEW.cmake47
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-OLD.cmake47
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt11
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-WARN.cmake5
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings-stderr.txt24
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings.cmake12
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-keywords-NEW.cmake25
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-keywords-OLD-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-keywords-OLD.cmake9
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-keywords-WARN-stderr.txt12
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-keywords-WARN.cmake3
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-command-scope-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-command-scope.cmake53
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope.cmake49
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-nested-if-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-nested-if.cmake41
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-while-scope-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0054/CMP0054-policy-while-scope.cmake65
-rw-r--r--Tests/RunCMake/CMP0054/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0054/RunCMakeTest.cmake13
25 files changed, 435 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMP0054/CMP0054-NEW-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-NEW-stderr.txt
new file mode 100644
index 0000000..f5a8fbe
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-NEW-stderr.txt
@@ -0,0 +1 @@
+$^
diff --git a/Tests/RunCMake/CMP0054/CMP0054-NEW.cmake b/Tests/RunCMake/CMP0054/CMP0054-NEW.cmake
new file mode 100644
index 0000000..23a9124
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-NEW.cmake
@@ -0,0 +1,47 @@
+cmake_policy(SET CMP0054 NEW)
+
+set(FOO "BAR")
+set(BAZ "ZZZ")
+set(MYTRUE ON)
+set(MYNUMBER 3)
+set(MYVERSION 3.0)
+
+function(assert_unquoted PREFIX FIRST)
+ string(REPLACE ";" " " ARGN_SP "${ARGN}")
+ if(${PREFIX} ${FIRST} ${ARGN})
+ message(FATAL_ERROR "Assertion failed [${PREFIX} ${FIRST} ${ARGN_SP}]")
+ endif()
+endfunction()
+
+function(assert_quoted PREFIX FIRST)
+ string(REPLACE ";" " " ARGN_SP "${ARGN}")
+ if(${PREFIX} "${FIRST}" ${ARGN})
+ message(FATAL_ERROR "Assertion failed [${PREFIX} \"${FIRST}\" ${ARGN_SP}]")
+ endif()
+endfunction()
+
+function(assert FIRST)
+ assert_unquoted(NOT ${FIRST} ${ARGN})
+ assert_quoted("" ${FIRST} ${ARGN})
+endfunction()
+
+assert(MYTRUE)
+
+assert(FOO MATCHES "^BAR$")
+
+assert(MYNUMBER LESS 4)
+assert(MYNUMBER GREATER 2)
+assert(MYNUMBER EQUAL 3)
+
+assert(FOO STRLESS CCC)
+assert(BAZ STRGREATER CCC)
+assert(FOO STREQUAL BAR)
+
+assert_unquoted(NOT MYVERSION VERSION_LESS 3.1)
+assert_unquoted("" MYVERSION VERSION_LESS 2.9)
+
+assert_quoted(NOT MYVERSION VERSION_LESS 2.9)
+assert_quoted(NOT MYVERSION VERSION_LESS 3.1)
+
+assert(MYVERSION VERSION_GREATER 2.9)
+assert(MYVERSION VERSION_EQUAL 3.0)
diff --git a/Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt
new file mode 100644
index 0000000..f5a8fbe
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt
@@ -0,0 +1 @@
+$^
diff --git a/Tests/RunCMake/CMP0054/CMP0054-OLD.cmake b/Tests/RunCMake/CMP0054/CMP0054-OLD.cmake
new file mode 100644
index 0000000..0c4cede
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-OLD.cmake
@@ -0,0 +1,47 @@
+cmake_policy(SET CMP0054 OLD)
+
+set(FOO "BAR")
+set(BAZ "ZZZ")
+set(MYTRUE ON)
+set(MYNUMBER 3)
+set(MYVERSION 3.0)
+
+function(assert_unquoted PREFIX FIRST)
+ string(REPLACE ";" " " ARGN_SP "${ARGN}")
+ if(${PREFIX} ${FIRST} ${ARGN})
+ message(FATAL_ERROR "Assertion failed [${PREFIX} ${FIRST} ${ARGN_SP}]")
+ endif()
+endfunction()
+
+function(assert_quoted PREFIX FIRST)
+ string(REPLACE ";" " " ARGN_SP "${ARGN}")
+ if(${PREFIX} "${FIRST}" ${ARGN})
+ message(FATAL_ERROR "Assertion failed [${PREFIX} \"${FIRST}\" ${ARGN_SP}]")
+ endif()
+endfunction()
+
+function(assert FIRST)
+ assert_unquoted(NOT ${FIRST} ${ARGN})
+ assert_quoted(NOT ${FIRST} ${ARGN})
+endfunction()
+
+assert(MYTRUE)
+
+assert(FOO MATCHES "^BAR$")
+
+assert(MYNUMBER LESS 4)
+assert(MYNUMBER GREATER 2)
+assert(MYNUMBER EQUAL 3)
+
+assert(FOO STRLESS CCC)
+assert(BAZ STRGREATER CCC)
+assert(FOO STREQUAL BAR)
+
+assert_unquoted(NOT MYVERSION VERSION_LESS 3.1)
+assert_unquoted("" MYVERSION VERSION_LESS 2.9)
+
+assert_quoted("" MYVERSION VERSION_LESS 2.9)
+assert_quoted(NOT MYVERSION VERSION_LESS 3.1)
+
+assert(MYVERSION VERSION_GREATER 2.9)
+assert(MYVERSION VERSION_EQUAL 3.0)
diff --git a/Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt
new file mode 100644
index 0000000..3d875ae
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at CMP0054-WARN.cmake:3 \(if\):
+ Policy CMP0054 is not set: Only interpret if\(\) arguments as variables or
+ keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ Quoted variables like "FOO" will no longer be dereferenced when the policy
+ is set to NEW. Since the policy is not set the OLD behavior will be used.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0054/CMP0054-WARN.cmake b/Tests/RunCMake/CMP0054/CMP0054-WARN.cmake
new file mode 100644
index 0000000..37855fc
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-WARN.cmake
@@ -0,0 +1,5 @@
+set(FOO "BAR")
+
+if(NOT "FOO" STREQUAL "BAR")
+ message(FATAL_ERROR "The given literals should match")
+endif()
diff --git a/Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings-stderr.txt
new file mode 100644
index 0000000..485db52
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings-stderr.txt
@@ -0,0 +1,24 @@
+CMake Warning \(dev\) at CMP0054-duplicate-warnings.cmake:4 \(if\):
+ Policy CMP0054 is not set: Only interpret if\(\) arguments as variables or
+ keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ Quoted variables like "FOO" will no longer be dereferenced when the policy
+ is set to NEW. Since the policy is not set the OLD behavior will be used.
+Call Stack \(most recent call first\):
+ CMP0054-duplicate-warnings.cmake:8 \(generate_warning\)
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\) at CMP0054-duplicate-warnings.cmake:11 \(if\):
+ Policy CMP0054 is not set: Only interpret if\(\) arguments as variables or
+ keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ Quoted variables like "FOO" will no longer be dereferenced when the policy
+ is set to NEW. Since the policy is not set the OLD behavior will be used.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings.cmake b/Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings.cmake
new file mode 100644
index 0000000..04fbe14
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-duplicate-warnings.cmake
@@ -0,0 +1,12 @@
+set(FOO "BAR")
+
+function(generate_warning)
+ if("FOO" STREQUAL "BAR")
+ endif()
+endfunction()
+
+generate_warning()
+generate_warning()
+
+if("FOO" STREQUAL "BAR")
+endif()
diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-result.txt b/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-stderr.txt
new file mode 100644
index 0000000..f444684
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at CMP0054-keywords-NEW.cmake:23 \(if\):
+ if given arguments:
+
+ "NOT" "1"
+
+ Unknown arguments specified
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW.cmake b/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW.cmake
new file mode 100644
index 0000000..b957658
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-NEW.cmake
@@ -0,0 +1,25 @@
+cmake_policy(SET CMP0054 NEW)
+
+function(assert KEYWORD)
+ if("${KEYWORD}" STREQUAL "${KEYWORD}")
+ else()
+ message(FATAL_ERROR
+ "Assertion failed [\"${KEYWORD}\" STREQUAL \"${KEYWORD}\"]")
+ endif()
+endfunction()
+
+assert("NOT")
+assert("COMMAND")
+assert("POLICY")
+assert("TARGET")
+assert("EXISTS")
+assert("IS_DIRECTORY")
+assert("IS_SYMLINK")
+assert("IS_ABSOLUTE")
+assert("DEFINED")
+assert("(")
+assert(")")
+
+if("NOT" 1)
+ message(FATAL_ERROR "[\"NOT\" 1] evaluated true")
+endif()
diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD-stderr.txt
new file mode 100644
index 0000000..f5a8fbe
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD-stderr.txt
@@ -0,0 +1 @@
+$^
diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD.cmake b/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD.cmake
new file mode 100644
index 0000000..a2a7f51
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD.cmake
@@ -0,0 +1,9 @@
+cmake_policy(SET CMP0054 OLD)
+
+if(NOT 1)
+ message(FATAL_ERROR "[NOT 1] evaluated true")
+endif()
+
+if("NOT" 1)
+ message(FATAL_ERROR "[\"NOT\" 1] evaluated true")
+endif()
diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN-stderr.txt
new file mode 100644
index 0000000..b1ebd49
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN-stderr.txt
@@ -0,0 +1,12 @@
+CMake Warning \(dev\) at CMP0054-keywords-WARN.cmake:1 \(if\):
+ Policy CMP0054 is not set: Only interpret if\(\) arguments as variables or
+ keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ Quoted keywords like "NOT" will no longer be interpreted as keywords when
+ the policy is set to NEW. Since the policy is not set the OLD behavior
+ will be used.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN.cmake b/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN.cmake
new file mode 100644
index 0000000..ee0a623
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-WARN.cmake
@@ -0,0 +1,3 @@
+if("NOT" 1)
+ message(FATAL_ERROR "[\"NOT\" 1] evaluated true")
+endif()
diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope-stderr.txt
new file mode 100644
index 0000000..f5a8fbe
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope-stderr.txt
@@ -0,0 +1 @@
+$^
diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope.cmake b/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope.cmake
new file mode 100644
index 0000000..b6b243c
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope.cmake
@@ -0,0 +1,53 @@
+set(FOO BAR)
+
+cmake_policy(SET CMP0054 NEW)
+
+function(function_defined_new_called_old)
+ 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()
+endfunction()
+
+macro(macro_defined_new_called_old)
+ 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()
+endmacro()
+
+cmake_policy(SET CMP0054 OLD)
+
+function_defined_new_called_old()
+macro_defined_new_called_old()
+
+function(function_defined_old_called_new)
+ 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()
+endfunction()
+
+macro(macro_defined_old_called_new)
+ 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()
+endmacro()
+
+cmake_policy(SET CMP0054 NEW)
+
+function_defined_old_called_new()
+macro_defined_old_called_new()
diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope-stderr.txt
new file mode 100644
index 0000000..f5a8fbe
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope-stderr.txt
@@ -0,0 +1 @@
+$^
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()
diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if-stderr.txt
new file mode 100644
index 0000000..f5a8fbe
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if-stderr.txt
@@ -0,0 +1 @@
+$^
diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if.cmake b/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if.cmake
new file mode 100644
index 0000000..dd7434d
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if.cmake
@@ -0,0 +1,41 @@
+set(FOO BAR)
+
+cmake_policy(SET CMP0054 NEW)
+
+if("FOO" STREQUAL BAR)
+ message(FATAL_ERROR "The strings should not match")
+
+ 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 quoted variable should match the string")
+ endif()
+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 quoted variable should match the string")
+
+ if(NOT "FOO" STREQUAL BAR)
+ message(FATAL_ERROR "The quoted variable should match the string")
+ endif()
+
+ cmake_policy(SET CMP0054 NEW)
+
+ if("FOO" STREQUAL BAR)
+ message(FATAL_ERROR "The strings should not match")
+ endif()
+endif()
+
+if(NOT "FOO" STREQUAL BAR)
+ message(FATAL_ERROR "The quoted variable should match the string")
+endif()
diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope-stderr.txt
new file mode 100644
index 0000000..f5a8fbe
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope-stderr.txt
@@ -0,0 +1 @@
+$^
diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope.cmake b/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope.cmake
new file mode 100644
index 0000000..2b22778
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope.cmake
@@ -0,0 +1,65 @@
+set(FOO BAR)
+
+set(LOOP_VAR "")
+
+cmake_policy(SET CMP0054 NEW)
+
+while(NOT LOOP_VAR STREQUAL "xx")
+ 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)
+
+ set(LOOP_VAR "${LOOP_VAR}x")
+endwhile()
+
+while("FOO" STREQUAL BAR)
+ message(FATAL_ERROR "The strings should not match")
+endwhile()
+
+set(LOOP_VAR "")
+
+cmake_policy(SET CMP0054 OLD)
+
+while(NOT LOOP_VAR STREQUAL "xx")
+ 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)
+
+ set(LOOP_VAR "${LOOP_VAR}x")
+endwhile()
+
+if(NOT "FOO" STREQUAL BAR)
+ message(FATAL_ERROR "The quoted variable should match the string")
+endif()
diff --git a/Tests/RunCMake/CMP0054/CMakeLists.txt b/Tests/RunCMake/CMP0054/CMakeLists.txt
new file mode 100644
index 0000000..2897109
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.0)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0054/RunCMakeTest.cmake b/Tests/RunCMake/CMP0054/RunCMakeTest.cmake
new file mode 100644
index 0000000..2f2fb76
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/RunCMakeTest.cmake
@@ -0,0 +1,13 @@
+include(RunCMake)
+
+run_cmake(CMP0054-OLD)
+run_cmake(CMP0054-NEW)
+run_cmake(CMP0054-WARN)
+run_cmake(CMP0054-keywords-NEW)
+run_cmake(CMP0054-keywords-OLD)
+run_cmake(CMP0054-keywords-WARN)
+run_cmake(CMP0054-duplicate-warnings)
+run_cmake(CMP0054-policy-command-scope)
+run_cmake(CMP0054-policy-foreach-scope)
+run_cmake(CMP0054-policy-while-scope)
+run_cmake(CMP0054-policy-nested-if)