diff options
author | Nils Gladitz <nilsgladitz@gmail.com> | 2014-09-04 18:21:28 (GMT) |
---|---|---|
committer | Nils Gladitz <nilsgladitz@gmail.com> | 2014-09-11 19:23:17 (GMT) |
commit | 188a1f236e1594fc46163fbad5e062e3978c1e5a (patch) | |
tree | ee62bcd7bc77a1defe2080a17451c01a985d293a /Tests/RunCMake/CMP0054/CMP0054-policy-nested-if.cmake | |
parent | b900c1ccaae7a500dda88240873122d0d899bf93 (diff) | |
download | CMake-188a1f236e1594fc46163fbad5e062e3978c1e5a.zip CMake-188a1f236e1594fc46163fbad5e062e3978c1e5a.tar.gz CMake-188a1f236e1594fc46163fbad5e062e3978c1e5a.tar.bz2 |
If: Introduce policy CMP0054 - don't dereference quoted variables in if()
Diffstat (limited to 'Tests/RunCMake/CMP0054/CMP0054-policy-nested-if.cmake')
-rw-r--r-- | Tests/RunCMake/CMP0054/CMP0054-policy-nested-if.cmake | 41 |
1 files changed, 41 insertions, 0 deletions
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() |