include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") unset (errors) cmake_path (APPEND path "/a/b" "c") set(output "$") if (NOT output STREQUAL path) list (APPEND errors "'${output}' instead of '${path}'") endif() set (path "a") cmake_path (APPEND path "") set(output "$") if (NOT output STREQUAL path) list (APPEND errors "'${output}' instead of '${path}'") endif() cmake_path (APPEND path "/b") set(output "$") if (NOT output STREQUAL path) list (APPEND errors "'${output}' instead of '${path}'") endif() if (WIN32) set (path "a") cmake_path (APPEND path "c:/b") set(output "$") if (NOT output STREQUAL path) list (APPEND errors "'${output}' instead of '${path}'") endif() set (path "a") cmake_path (APPEND path "c:") set(output "$") if (NOT output STREQUAL path) list (APPEND errors "'${output}' instead of '${path}'") endif() set (path "c:a") cmake_path (APPEND path "/b") set(output "$") if (NOT output STREQUAL path) list (APPEND errors "'${output}' instead of '${path}'") endif() set (path "c:a") cmake_path (APPEND path "c:b") set(output "$") if (NOT output STREQUAL path) list (APPEND errors "'${output}' instead of '${path}'") endif() set (path "//host") cmake_path (APPEND path "b") set(output "$") if (NOT output STREQUAL path) list (APPEND errors "'${output}' instead of '${path}'") endif() set (path "//host/") cmake_path (APPEND path "b") set(output "$") if (NOT output STREQUAL path) list (APPEND errors "'${output}' instead of '${path}'") endif() endif() ###################################### ## tests with list of paths ###################################### unset(reference) foreach(item IN ITEMS "/a/b" "/x/y") cmake_path (APPEND result "${item}" "c") list(APPEND reference "${result}") endforeach() set(output "$") if (NOT output STREQUAL reference) list (APPEND errors "'${output}' instead of '${reference}'") endif() unset(reference) foreach(item IN ITEMS "a" "c") cmake_path (APPEND item "") list(APPEND reference "${item}") endforeach() set(output "$") if (NOT output STREQUAL reference) list (APPEND errors "'${output}' instead of '${reference}'") endif() unset(reference) foreach(item IN ITEMS "a/" "c/") cmake_path (APPEND item "/b") list(APPEND reference "${item}") endforeach() set(output "$") if (NOT output STREQUAL reference) list (APPEND errors "'${output}' instead of '${reference}'") endif() check_errors ("PATH:APPEND" ${errors})