summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope.cmake
blob: b6b243caa2fb2bed145aabac212a5a9acbcb17b3 (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
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()