diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-07-23 14:54:12 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2020-09-06 08:52:25 (GMT) |
commit | eb583b0a660ba68e8e3b5f820301fde333619283 (patch) | |
tree | d88a52fdc1af9843ee4adceb1a37c66148d48c2e /Tests/RunCMake/cmake_path/IS_RELATIVE.cmake | |
parent | 212e953d352c2ca20cf6280492633d21fbacdbc9 (diff) | |
download | CMake-eb583b0a660ba68e8e3b5f820301fde333619283.zip CMake-eb583b0a660ba68e8e3b5f820301fde333619283.tar.gz CMake-eb583b0a660ba68e8e3b5f820301fde333619283.tar.bz2 |
cmake_path command: path management
Fixes: #19568, #20922
Diffstat (limited to 'Tests/RunCMake/cmake_path/IS_RELATIVE.cmake')
-rw-r--r-- | Tests/RunCMake/cmake_path/IS_RELATIVE.cmake | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE.cmake b/Tests/RunCMake/cmake_path/IS_RELATIVE.cmake new file mode 100644 index 0000000..ad12253 --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_RELATIVE.cmake @@ -0,0 +1,48 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +if (WIN32) + set (path "c:/a") +else() + set (path "/a") +endif() +cmake_path(IS_RELATIVE path output) +if (output) + list (APPEND errors "'${path} is relative") +endif() + +set (path "a/b") +cmake_path(IS_RELATIVE path output) +if (NOT output) + list (APPEND errors "'${path} is not relative") +endif() + +if (WIN32) + set (path "c:/a/b") + cmake_path(IS_RELATIVE path output) + if (output) + list (APPEND errors "'${path} is relative") + endif() + + set (path "//host/b") + cmake_path(IS_RELATIVE path output) + if (output) + list (APPEND errors "'${path} is relative") + endif() + + set (path "/a") + cmake_path(IS_RELATIVE path output) + if (NOT output) + list (APPEND errors "'${path} is not relative") + endif() + + set (path "c:a") + cmake_path(IS_RELATIVE path output) + if (NOT output) + list (APPEND errors "'${path} is not relative") + endif() +endif() + + +check_errors (IS_RELATIVE ${errors}) |