summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/GenEx-PATH/IS_ABSOLUTE.cmake.in
blob: 872dae484aaea3806034053b741a41182153c1f5 (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

include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
unset (errors)

if (WIN32)
  set(path "c:/a")
  set(output "$<PATH:IS_ABSOLUTE,c:/a>")
else()
  set(path "/a")
  set(output "$<PATH:IS_ABSOLUTE,/a>")
endif()
if (NOT output)
  list (APPEND errors "'${path}' is not absolute")
endif()

set(output "$<PATH:IS_ABSOLUTE,a/b>")
if (output)
  list (APPEND errors "'a/b' is absolute")
endif()

if (WIN32)
  set(output "$<PATH:IS_ABSOLUTE,c:/a/b>")
  if (NOT output)
    list (APPEND errors "'c:/a/b' is not absolute")
  endif()

  set(output "$<PATH:IS_ABSOLUTE,//host/b>")
  if (NOT output)
    list (APPEND errors "'//host/b' is not absolute")
  endif()

  set(output "$<PATH:IS_ABSOLUTE,/a>")
  if (output)
    list (APPEND errors "'/a' is absolute")
  endif()

  set(output "$<PATH:IS_ABSOLUTE,c:a>")
  if (output)
    list (APPEND errors "'c:a' is absolute")
  endif()
endif()


check_errors("PATH:IS_ABSOLUTE" ${errors})