summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/cmake_path/NATIVE_PATH.cmake
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2020-07-23 14:54:12 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2020-09-06 08:52:25 (GMT)
commiteb583b0a660ba68e8e3b5f820301fde333619283 (patch)
treed88a52fdc1af9843ee4adceb1a37c66148d48c2e /Tests/RunCMake/cmake_path/NATIVE_PATH.cmake
parent212e953d352c2ca20cf6280492633d21fbacdbc9 (diff)
downloadCMake-eb583b0a660ba68e8e3b5f820301fde333619283.zip
CMake-eb583b0a660ba68e8e3b5f820301fde333619283.tar.gz
CMake-eb583b0a660ba68e8e3b5f820301fde333619283.tar.bz2
cmake_path command: path management
Fixes: #19568, #20922
Diffstat (limited to 'Tests/RunCMake/cmake_path/NATIVE_PATH.cmake')
-rw-r--r--Tests/RunCMake/cmake_path/NATIVE_PATH.cmake37
1 files changed, 37 insertions, 0 deletions
diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH.cmake b/Tests/RunCMake/cmake_path/NATIVE_PATH.cmake
new file mode 100644
index 0000000..066c44d
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NATIVE_PATH.cmake
@@ -0,0 +1,37 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+if (WIN32)
+ set (path "c:/a//b\\c/..\\d")
+ cmake_path(NATIVE_PATH path output)
+ if (NOT output STREQUAL "c:\\a\\\\b\\c\\..\\d")
+ list (APPEND errors "'${output}' instead of 'c:\\a\\\\b\\c\\..\\d'")
+ endif()
+ cmake_path(NATIVE_PATH path output NORMALIZE)
+ if (NOT output STREQUAL "c:\\a\\b\\d")
+ list (APPEND errors "'${output}' instead of 'c:\\a\\b\\d'")
+ endif()
+
+ set (path "//host/a//b\\c/..\\d")
+ cmake_path(NATIVE_PATH path output)
+ if (NOT output STREQUAL "\\\\host\\a\\\\b\\c\\..\\d")
+ list (APPEND errors "'${output}' instead of '\\\\host\\a\\\\b\\c\\..\\d'")
+ endif()
+ cmake_path(NATIVE_PATH path output NORMALIZE)
+ if (NOT output STREQUAL "\\\\host\\a\\b\\d")
+ list (APPEND errors "'${output}' instead of '\\\\host\\a\\b\\d'")
+ endif()
+else()
+ set (path "/a//b/c/../d")
+ cmake_path(NATIVE_PATH path output)
+ if (NOT output STREQUAL "/a//b/c/../d")
+ list (APPEND errors "'${output}' instead of '/a//b/c/../d'")
+ endif()
+ cmake_path(NATIVE_PATH path NORMALIZE output)
+ if (NOT output STREQUAL "/a/b/d")
+ list (APPEND errors "'${output}' instead of '/a/b/d'")
+ endif()
+endif()
+
+check_errors (NATIVE_PATH ${errors})