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.
312 lines
9.4 KiB
312 lines
9.4 KiB
|
|
include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
|
|
unset (errors)
|
|
|
|
###############################################
|
|
## First test with a path defining all elements
|
|
###############################################
|
|
if (WIN32)
|
|
set (path "C:/aa/bb/cc.ext1.ext2")
|
|
else()
|
|
set (path "/aa/bb/cc.ext1.ext2")
|
|
endif()
|
|
|
|
cmake_path(GET path ROOT_NAME reference)
|
|
if (WIN32)
|
|
set(output "$<PATH:GET_ROOT_NAME,C:/aa/bb/cc.ext1.ext2>")
|
|
else()
|
|
set (output "$<PATH:GET_ROOT_NAME,/aa/bb/cc.ext1.ext2>")
|
|
endif()
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "ROOT_NAME returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path ROOT_DIRECTORY reference)
|
|
if (WIN32)
|
|
set(output "$<PATH:GET_ROOT_DIRECTORY,C:/aa/bb/cc.ext1.ext2>")
|
|
else()
|
|
set (output "$<PATH:GET_ROOT_DIRECTORY,/aa/bb/cc.ext1.ext2>")
|
|
endif()
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path ROOT_PATH reference)
|
|
if (WIN32)
|
|
set(output "$<PATH:GET_ROOT_PATH,C:/aa/bb/cc.ext1.ext2>")
|
|
else()
|
|
set (output "$<PATH:GET_ROOT_PATH,/aa/bb/cc.ext1.ext2>")
|
|
endif()
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "ROOT_PATH returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path FILENAME reference)
|
|
if (WIN32)
|
|
set(output "$<PATH:GET_FILENAME,C:/aa/bb/cc.ext1.ext2>")
|
|
else()
|
|
set (output "$<PATH:GET_FILENAME,/aa/bb/cc.ext1.ext2>")
|
|
endif()
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "FILENAME returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path EXTENSION reference)
|
|
if (WIN32)
|
|
set(output "$<PATH:GET_EXTENSION,C:/aa/bb/cc.ext1.ext2>")
|
|
else()
|
|
set (output "$<PATH:GET_EXTENSION,/aa/bb/cc.ext1.ext2>")
|
|
endif()
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "EXTENSION returns bad data: ${output}")
|
|
endif()
|
|
cmake_path(GET path EXTENSION LAST_ONLY reference)
|
|
if (WIN32)
|
|
set(output "$<PATH:GET_EXTENSION,LAST_ONLY,C:/aa/bb/cc.ext1.ext2>")
|
|
else()
|
|
set (output "$<PATH:GET_EXTENSION,LAST_ONLY,/aa/bb/cc.ext1.ext2>")
|
|
endif()
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "EXTENSION LAST_ONLY returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path STEM reference)
|
|
if (WIN32)
|
|
set(output "$<PATH:GET_STEM,C:/aa/bb/cc.ext1.ext2>")
|
|
else()
|
|
set (output "$<PATH:GET_STEM,/aa/bb/cc.ext1.ext2>")
|
|
endif()
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "STEM returns bad data: ${output}")
|
|
endif()
|
|
cmake_path(GET path STEM LAST_ONLY reference)
|
|
if (WIN32)
|
|
set(output "$<PATH:GET_STEM,LAST_ONLY,C:/aa/bb/cc.ext1.ext2>")
|
|
else()
|
|
set (output "$<PATH:GET_STEM,LAST_ONLY,/aa/bb/cc.ext1.ext2>")
|
|
endif()
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "STEM LAST_ONLY returns bad data: ${reference}")
|
|
endif()
|
|
|
|
cmake_path(GET path RELATIVE_PART reference)
|
|
if (WIN32)
|
|
set(output "$<PATH:GET_RELATIVE_PART,C:/aa/bb/cc.ext1.ext2>")
|
|
else()
|
|
set (output "$<PATH:GET_RELATIVE_PART,/aa/bb/cc.ext1.ext2>")
|
|
endif()
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "RELATIVE_PART returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path PARENT_PATH reference)
|
|
if (WIN32)
|
|
set(output "$<PATH:GET_PARENT_PATH,C:/aa/bb/cc.ext1.ext2>")
|
|
else()
|
|
set (output "$<PATH:GET_PARENT_PATH,/aa/bb/cc.ext1.ext2>")
|
|
endif()
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "PARENT_PATH returns bad data: ${output}")
|
|
endif()
|
|
|
|
######################################
|
|
## second, tests with missing elements
|
|
######################################
|
|
set (path "aa/bb/")
|
|
|
|
cmake_path(GET path ROOT_NAME reference)
|
|
set(output "$<PATH:GET_ROOT_NAME,aa/bb/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "ROOT_NAME returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path ROOT_DIRECTORY reference)
|
|
set(output "$<PATH:GET_ROOT_DIRECTORY,aa/bb/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "ROOT_DIRECTORY returns bad data: >${output}<, >${reference}<")
|
|
endif()
|
|
|
|
cmake_path(GET path ROOT_PATH reference)
|
|
set(output "$<PATH:GET_ROOT_PATH,aa/bb/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "ROOT_PATH returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path FILENAME reference)
|
|
set(output "$<PATH:GET_FILENAME,aa/bb/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "FILENAME returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path EXTENSION reference)
|
|
set(output "$<PATH:GET_EXTENSION,aa/bb/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "EXTENSION returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path STEM reference)
|
|
set(output "$<PATH:GET_STEM,aa/bb/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "STEM returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path RELATIVE_PART reference)
|
|
set(output "$<PATH:GET_RELATIVE_PART,aa/bb/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "RELATIVE_PART returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path PARENT_PATH reference)
|
|
set(output "$<PATH:GET_PARENT_PATH,aa/bb/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "PARENT_PATH returns bad data: ${output}")
|
|
endif()
|
|
|
|
##################################
|
|
set (path "/aa/bb/")
|
|
|
|
cmake_path(GET path ROOT_NAME reference)
|
|
set(output "$<PATH:GET_ROOT_NAME,/aa/bb/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "ROOT_NAME returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path ROOT_DIRECTORY reference)
|
|
set(output "$<PATH:GET_ROOT_DIRECTORY,/aa/bb/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path ROOT_PATH reference)
|
|
set(output "$<PATH:GET_ROOT_PATH,/aa/bb/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "ROOT_PATH returns bad data: ${output}")
|
|
endif()
|
|
|
|
###################################
|
|
set (path "/")
|
|
|
|
cmake_path(GET path ROOT_NAME reference)
|
|
set(output "$<PATH:GET_ROOT_NAME,/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "ROOT_NAME returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path ROOT_DIRECTORY reference)
|
|
set(output "$<PATH:GET_ROOT_DIRECTORY,/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path ROOT_PATH reference)
|
|
set(output "$<PATH:GET_ROOT_PATH,/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "ROOT_PATH returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path FILENAME reference)
|
|
set(output "$<PATH:GET_FILENAME,/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "FILENAME returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path EXTENSION reference)
|
|
set(output "$<PATH:GET_EXTENSION,/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "EXTENSION returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path STEM reference)
|
|
set(output "$<PATH:GET_STEM,/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "STEM returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path RELATIVE_PART reference)
|
|
set(output "$<PATH:GET_RELATIVE_PART,/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "RELATIVE_PART returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path PARENT_PATH reference)
|
|
set(output "$<PATH:GET_PARENT_PATH,/>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "PARENT_PATH returns bad data: ${output}")
|
|
endif()
|
|
|
|
###################################
|
|
set (path ".file")
|
|
|
|
cmake_path(GET path FILENAME reference)
|
|
set(output "$<PATH:GET_FILENAME,.file>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "FILENAME returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path EXTENSION reference)
|
|
set(output "$<PATH:GET_EXTENSION,.file>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "EXTENSION returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path STEM reference)
|
|
set(output "$<PATH:GET_STEM,.file>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "STEM returns bad data: ${output}")
|
|
endif()
|
|
|
|
###################################
|
|
set (path ".file.ext")
|
|
|
|
cmake_path(GET path FILENAME reference)
|
|
set(output "$<PATH:GET_FILENAME,.file.ext>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "FILENAME returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path EXTENSION reference)
|
|
set(output "$<PATH:GET_EXTENSION,.file.ext>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "EXTENSION returns bad data: ${output}")
|
|
endif()
|
|
cmake_path(GET path EXTENSION LAST_ONLY reference)
|
|
set(output "$<PATH:GET_EXTENSION,LAST_ONLY,.file.ext>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "EXTENSION returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path STEM reference)
|
|
set(output "$<PATH:GET_STEM,.file.ext>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "STEM returns bad data: ${output}")
|
|
endif()
|
|
|
|
###################################
|
|
set (path ".file.ext1.ext2")
|
|
|
|
cmake_path(GET path FILENAME reference)
|
|
set(output "$<PATH:GET_FILENAME,.file.ext1.ext2>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "FILENAME returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path EXTENSION reference)
|
|
set(output "$<PATH:GET_EXTENSION,.file.ext1.ext2>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "EXTENSION returns bad data: ${output}")
|
|
endif()
|
|
cmake_path(GET path EXTENSION LAST_ONLY reference)
|
|
set(output "$<PATH:GET_EXTENSION,LAST_ONLY,.file.ext1.ext2>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "EXTENSION returns bad data: ${output}")
|
|
endif()
|
|
|
|
cmake_path(GET path STEM reference)
|
|
set(output "$<PATH:GET_STEM,.file.ext1.ext2>")
|
|
if (NOT output STREQUAL reference)
|
|
list (APPEND errors "STEM returns bad data: ${output}")
|
|
endif()
|
|
|
|
|
|
check_errors("PATH:GET..." ${errors})
|