summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake
blob: 4fd3c7df81d1aa7d32fc09e825c478096b9ae517 (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

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})