1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00
Files
CMake/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake
2020-09-06 10:52:25 +02:00

40 lines
1.1 KiB
CMake

include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
unset (errors)
set (path "../../a/d")
cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f")
if (NOT path STREQUAL "/x/y/a/f/../../a/d")
list (APPEND errors "'${path}' instead of '/x/y/a/f/../../a/d'")
endif()
set (path "../../a/d")
cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f" NORMALIZE)
if (NOT path STREQUAL "/x/y/a/d")
list (APPEND errors "'${path}' instead of '/x/y/a/d'")
endif()
set (path "../../a/d")
cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f" NORMALIZE OUTPUT_VARIABLE output)
if (NOT path STREQUAL "../../a/d")
list (APPEND errors "input changed unexpectedly")
endif()
if (NOT output STREQUAL "/x/y/a/d")
list (APPEND errors "'${output}' instead of '/x/y/a/d'")
endif()
set (path "/a/d/../e")
cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f")
if (NOT path STREQUAL "/a/d/../e")
list (APPEND errors "'${path}' instead of '/a/d/../e'")
endif()
set (path "/a/d/../e")
cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f" NORMALIZE)
if (NOT path STREQUAL "/a/e")
list (APPEND errors "'${path}' instead of '/a/e'")
endif()
check_errors (ABSOLUTE_PATH ${errors})