1
2include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
3unset (errors)
4
5cmake_path(CONVERT "/x/y/z/../../a/d" TO_CMAKE_PATH_LIST output)
6if (NOT output STREQUAL "/x/y/z/../../a/d")
7  list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d'")
8endif()
9cmake_path(CONVERT "/x/y/z/../../a/d" TO_CMAKE_PATH_LIST output NORMALIZE)
10if (NOT output STREQUAL "/x/a/d")
11  list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d'")
12endif()
13
14if (WIN32)
15  cmake_path(CONVERT "/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output)
16  if (NOT output STREQUAL "/x/y/z/../../a/d")
17    list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d'")
18  endif()
19  cmake_path(CONVERT "/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output NORMALIZE)
20  if (NOT output STREQUAL "/x/a/d")
21    list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d'")
22  endif()
23
24  cmake_path(CONVERT "//?/c:/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output)
25  if (NOT output STREQUAL "c:/x/y/z/../../a/d")
26    list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of 'c:/x/y/z/../../a/d'")
27  endif()
28  cmake_path(CONVERT "//?/c:/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output NORMALIZE)
29  if (NOT output STREQUAL "c:/x/a/d")
30    list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of 'c:/x/a/d'")
31  endif()
32
33  cmake_path(CONVERT "//?/UNC/host/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output)
34  if (NOT output STREQUAL "//host/x/y/z/../../a/d")
35    list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '//host/x/y/z/../../a/d'")
36  endif()
37  cmake_path(CONVERT "//?/UNC/host/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output NORMALIZE)
38  if (NOT output STREQUAL "//host/x/a/d")
39    list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '//host/x/a/d'")
40  endif()
41endif()
42
43if (WIN32)
44  cmake_path(CONVERT "/x\\y/z/..\\../a\\d;c:\\a/b\\c/..\\d" TO_CMAKE_PATH_LIST output)
45  if (NOT output STREQUAL "/x/y/z/../../a/d;c:/a/b/c/../d")
46    list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d;c:/a/b/c/../d'")
47  endif()
48  cmake_path(CONVERT "/x\\y/z/..\\../a\\d;c:\\a/b\\c/..\\d" TO_CMAKE_PATH_LIST output NORMALIZE)
49  if (NOT output STREQUAL "/x/a/d;c:/a/b/d")
50    list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d;c:/a/b/d'")
51  endif()
52else()
53  cmake_path(CONVERT "/x/y/z/../../a/d:/a/b/c/../d" TO_CMAKE_PATH_LIST output)
54  if (NOT output STREQUAL "/x/y/z/../../a/d;/a/b/c/../d")
55    list (APPEND errors "TO_CMAKE_PATH_LIST: '${outputh}' instead of '/x/y/z/../../a/d;/a/b/c/../d'")
56  endif()
57  cmake_path(CONVERT "/x/y/z/../../a/d:/a/b/c/../d" TO_CMAKE_PATH_LIST output NORMALIZE)
58  if (NOT output STREQUAL "/x/a/d;/a/b/d")
59    list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d;/a/b/d'")
60  endif()
61endif()
62
63
64if (WIN32)
65  cmake_path(CONVERT "c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output)
66  if (NOT output STREQUAL "c:\\a\\\\b\\c\\..\\d")
67    list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of 'c:\\a\\\\b\\c\\..\\d'")
68  endif()
69  cmake_path(CONVERT "c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output NORMALIZE)
70  if (NOT output STREQUAL "c:\\a\\b\\d")
71    list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of 'c:\\a\\b\\d'")
72  endif()
73
74  cmake_path(CONVERT "//host/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output)
75  if (NOT output STREQUAL "\\\\host\\a\\\\b\\c\\..\\d")
76    list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\\\b\\c\\..\\d'")
77  endif()
78  cmake_path(CONVERT "//host/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output NORMALIZE)
79  if (NOT output STREQUAL "\\\\host\\a\\b\\d")
80    list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\b\\d'")
81  endif()
82  cmake_path(CONVERT "//host/a//b\\c/..\\d;c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output)
83  if (NOT output STREQUAL "\\\\host\\a\\\\b\\c\\..\\d;c:\\a\\\\b\\c\\..\\d")
84    list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\\\b\\c\\..\\d;c:\\a\\\\b\\c\\..\\d'")
85  endif()
86  cmake_path(CONVERT "//host/a//b\\c/..\\d;c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output NORMALIZE)
87  if (NOT output STREQUAL "\\\\host\\a\\b\\d;c:\\a\\b\\d")
88    list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\b\\d;c:\\a\\b\\d'")
89  endif()
90else()
91  cmake_path(CONVERT "/a//b/c/../d" TO_NATIVE_PATH_LIST output)
92  if (NOT output STREQUAL "/a//b/c/../d")
93    list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/a//b/c/../d'")
94  endif()
95  cmake_path(CONVERT "/a//b/c/../d" TO_NATIVE_PATH_LIST output NORMALIZE)
96  if (NOT output STREQUAL "/a/b/d")
97    list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/a/b/d'")
98  endif()
99  cmake_path(CONVERT "/x/y/z/../../a/d;/a/b/c/../d" TO_NATIVE_PATH_LIST output)
100  if (NOT output STREQUAL "/x/y/z/../../a/d:/a/b/c/../d")
101    list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d:/a/b/c/../d'")
102  endif()
103  cmake_path(CONVERT "/x/y/z/../../a/d;/a/b/c/../d" TO_NATIVE_PATH_LIST output NORMALIZE)
104  if (NOT output STREQUAL "/x/a/d:/a/b/d")
105    list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/x/a/d:/a/b/d'")
106  endif()
107endif()
108
109
110check_errors (CONVERT ${errors})
111