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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
unset (errors)
cmake_path (APPEND path "/a/b" "c")
set(output "$<PATH:APPEND,/a/b,c>")
if (NOT output STREQUAL path)
list (APPEND errors "'${output}' instead of '${path}'")
endif()
set (path "a")
cmake_path (APPEND path "")
set(output "$<PATH:APPEND,a,>")
if (NOT output STREQUAL path)
list (APPEND errors "'${output}' instead of '${path}'")
endif()
cmake_path (APPEND path "/b")
set(output "$<PATH:APPEND,a/,/b>")
if (NOT output STREQUAL path)
list (APPEND errors "'${output}' instead of '${path}'")
endif()
if (WIN32)
set (path "a")
cmake_path (APPEND path "c:/b")
set(output "$<PATH:APPEND,a,c:/b>")
if (NOT output STREQUAL path)
list (APPEND errors "'${output}' instead of '${path}'")
endif()
set (path "a")
cmake_path (APPEND path "c:")
set(output "$<PATH:APPEND,a,c:>")
if (NOT output STREQUAL path)
list (APPEND errors "'${output}' instead of '${path}'")
endif()
set (path "c:a")
cmake_path (APPEND path "/b")
set(output "$<PATH:APPEND,c:a,/b>")
if (NOT output STREQUAL path)
list (APPEND errors "'${output}' instead of '${path}'")
endif()
set (path "c:a")
cmake_path (APPEND path "c:b")
set(output "$<PATH:APPEND,c:a,c:b>")
if (NOT output STREQUAL path)
list (APPEND errors "'${output}' instead of '${path}'")
endif()
set (path "//host")
cmake_path (APPEND path "b")
set(output "$<PATH:APPEND,//host,b>")
if (NOT output STREQUAL path)
list (APPEND errors "'${output}' instead of '${path}'")
endif()
set (path "//host/")
cmake_path (APPEND path "b")
set(output "$<PATH:APPEND,//host/,b>")
if (NOT output STREQUAL path)
list (APPEND errors "'${output}' instead of '${path}'")
endif()
endif()
######################################
## tests with list of paths
######################################
unset(reference)
foreach(item IN ITEMS "/a/b" "/x/y")
cmake_path (APPEND result "${item}" "c")
list(APPEND reference "${result}")
endforeach()
set(output "$<PATH:APPEND,/a/b;/x/y,c>")
if (NOT output STREQUAL reference)
list (APPEND errors "'${output}' instead of '${reference}'")
endif()
unset(reference)
foreach(item IN ITEMS "a" "c")
cmake_path (APPEND item "")
list(APPEND reference "${item}")
endforeach()
set(output "$<PATH:APPEND,a;c,>")
if (NOT output STREQUAL reference)
list (APPEND errors "'${output}' instead of '${reference}'")
endif()
unset(reference)
foreach(item IN ITEMS "a/" "c/")
cmake_path (APPEND item "/b")
list(APPEND reference "${item}")
endforeach()
set(output "$<PATH:APPEND,a/;c/,/b>")
if (NOT output STREQUAL reference)
list (APPEND errors "'${output}' instead of '${reference}'")
endif()
check_errors ("PATH:APPEND" ${errors})
|