summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/cmake_path/IS_ABSOLUTE.cmake
blob: 794e7863701910b2792308594017935556710f87 (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

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

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

set (path "a/b")
cmake_path(IS_ABSOLUTE path output)
if (output)
  list (APPEND errors "'${path} is absolute")
endif()

if (WIN32)
  set (path "c:/a/b")
  cmake_path(IS_ABSOLUTE path output)
  if (NOT output)
    list (APPEND errors "'${path} is not absolute")
  endif()

  set (path "//host/b")
  cmake_path(IS_ABSOLUTE path output)
  if (NOT output)
    list (APPEND errors "'${path} is not absolute")
  endif()

  set (path "/a")
  cmake_path(IS_ABSOLUTE path output)
  if (output)
    list (APPEND errors "'${path} is absolute")
  endif()

  set (path "c:a")
  cmake_path(IS_ABSOLUTE path output)
  if (output)
    list (APPEND errors "'${path} is absolute")
  endif()
endif()


check_errors (IS_ABSOLUTE ${errors})