summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope.cmake
blob: 2b22778b5d74d3c887546fe902652949c651e3d8 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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()