diff options
Diffstat (limited to 'Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake')
-rw-r--r-- | Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake b/Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake new file mode 100644 index 0000000..f7a9600 --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake @@ -0,0 +1,26 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "a/b/c.e.f") +cmake_path (REPLACE_FILENAME path "x.y") +if (NOT path STREQUAL "a/b/x.y") + list (APPEND errors "'${path}' instead of 'a/b/x.y'") +endif() + +set (path "a/b/") +cmake_path (REPLACE_FILENAME path "x.y") +if (NOT path STREQUAL "a/b/") + list (APPEND errors "'${path}' instead of 'a/b/'") +endif() + +set (path "a/b/c.e.f") +cmake_path (REPLACE_FILENAME path "" OUTPUT_VARIABLE output) +if (NOT path STREQUAL "a/b/c.e.f") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "a/b/") + list (APPEND errors "'${output}' instead of 'a/b/'") +endif() + +check_errors (REPLACE_FILENAME ${errors}) |