You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.0 KiB
65 lines
2.0 KiB
|
|
include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
|
|
unset (errors)
|
|
|
|
set (reference "/a//d")
|
|
cmake_path(RELATIVE_PATH reference BASE_DIRECTORY "/a/b/c")
|
|
set(output "$<PATH:RELATIVE_PATH,/a//d,/a/b/c>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "'${output}' instead of '${reference}'")
|
|
endif()
|
|
|
|
set (reference "/a//b///c")
|
|
cmake_path(RELATIVE_PATH reference BASE_DIRECTORY "/a/d")
|
|
set(output "$<PATH:RELATIVE_PATH,/a/b///c,/a/d>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "'${output}' instead of '${reference}'")
|
|
endif()
|
|
|
|
set (reference "a/b/c")
|
|
cmake_path(RELATIVE_PATH reference BASE_DIRECTORY "a")
|
|
set(output "$<PATH:RELATIVE_PATH,a/b/c,a>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "'${output}' instead of '${reference}'")
|
|
endif()
|
|
|
|
set (reference "a/b/c")
|
|
cmake_path(RELATIVE_PATH reference BASE_DIRECTORY "a/b/c/x/y")
|
|
set(output "$<PATH:RELATIVE_PATH,a/b/c,a/b/c/x/y>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "'${output}' instead of '${reference}'")
|
|
endif()
|
|
|
|
set (reference "a/b/c")
|
|
cmake_path(RELATIVE_PATH reference BASE_DIRECTORY "a/b/c")
|
|
set(output "$<PATH:RELATIVE_PATH,a/b/c,a/b/c>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "'${output}' instead of '${reference}'")
|
|
endif()
|
|
|
|
set (reference "a/b")
|
|
cmake_path(RELATIVE_PATH reference BASE_DIRECTORY "c/d")
|
|
set(output "$<PATH:RELATIVE_PATH,a/b,c/d>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "'${output}' instead of '${reference}'")
|
|
endif()
|
|
|
|
set (reference "/a/d")
|
|
cmake_path(RELATIVE_PATH reference BASE_DIRECTORY "e/d/c")
|
|
set(output "$<PATH:RELATIVE_PATH,/a/d,e/d/c>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "'${output}' instead of '${reference}'")
|
|
endif()
|
|
|
|
if (WIN32)
|
|
set (reference "c:/a/d")
|
|
cmake_path(RELATIVE_PATH reference BASE_DIRECTORY "e/d/c")
|
|
set(output "$<PATH:RELATIVE_PATH,c:/a/d,e/d/c>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "'${output}' instead of '${reference}'")
|
|
endif()
|
|
endif()
|
|
|
|
|
|
check_errors("PATH:RELATIVE_PATH" ${errors})
|