1
2include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
3unset (errors)
4
5set (path "a/b/c.e.f")
6cmake_path (REPLACE_EXTENSION path ".x")
7if (NOT path STREQUAL "a/b/c.x")
8  list (APPEND errors "'${path}' instead of 'a/b/c.x'")
9endif()
10cmake_path (REPLACE_EXTENSION path ".y")
11if (NOT path STREQUAL "a/b/c.y")
12  list (APPEND errors "'${path}' instead of 'a/b/c.y'")
13endif()
14cmake_path (REPLACE_EXTENSION path "")
15if (NOT path STREQUAL "a/b/c")
16  list (APPEND errors "'${path}' instead of 'a/b/c'")
17endif()
18
19set (path "a/b/c.e.f")
20cmake_path (REPLACE_EXTENSION path ".x" LAST_ONLY)
21if (NOT path STREQUAL "a/b/c.e.x")
22  list (APPEND errors "'${path}' instead of 'a/b/c.e.x'")
23endif()
24cmake_path (REPLACE_EXTENSION path ".y" LAST_ONLY)
25if (NOT path STREQUAL "a/b/c.e.y")
26  list (APPEND errors "'${path}' instead of 'a/b/c.e.y'")
27endif()
28cmake_path (REPLACE_EXTENSION path "" LAST_ONLY)
29if (NOT path STREQUAL "a/b/c.e")
30  list (APPEND errors "'${path}' instead of 'a/b/c.e'")
31endif()
32
33set (path "/a/.b")
34cmake_path (REPLACE_EXTENSION path ".x")
35if (NOT path STREQUAL "/a/.b.x")
36  list (APPEND errors "'${path}' instead of '/a/.b.x'")
37endif()
38cmake_path (REPLACE_EXTENSION path ".x" LAST_ONLY)
39if (NOT path STREQUAL "/a/.b.x")
40  list (APPEND errors "'${path}' instead of '/a/.b.x'")
41endif()
42
43set (path "/a/b")
44cmake_path (REPLACE_EXTENSION path ".x")
45if (NOT path STREQUAL "/a/b.x")
46  list (APPEND errors "'${path}' instead of '/a/b.x'")
47endif()
48
49set (path "/a/b/")
50cmake_path (REPLACE_EXTENSION path ".x" OUTPUT_VARIABLE output)
51if (NOT path STREQUAL "/a/b/")
52  list (APPEND errors "input changed unexpectedly")
53endif()
54if (NOT output STREQUAL "/a/b/.x")
55  list (APPEND errors "'${output}' instead of '/a/b/.x'")
56endif()
57
58check_errors (REPLACE_EXTENSION ${errors})
59