diff options
Diffstat (limited to 'Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake')
-rw-r--r-- | Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake new file mode 100644 index 0000000..4fd3c7d --- /dev/null +++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake @@ -0,0 +1,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}) |