summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope.cmake
blob: 87c968a06dfd241f397ebf3020b56607a2884125 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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()