cmake_path(IS_PREFIX) help page example is showing incorrect result
The cmake_path command added in cmake 3.20 contains an IS_PREFIX subcommand that states that
Checks if
<path-var>
is the prefix of<input>
.
But looking at the example on the page, the first invocation to that command has incorrect result that the result is true when it should be false
set(path "/a/b/c/d")
cmake_path(IS_PREFIX path "/a/b" result) # result = true
cmake_path(IS_PREFIX path "/x/y/z" result) # result = false
It makes it seem as if the <input>
has to be a prefix of the <path-var>
which is incorrect.
The command actually works correctly according to the description, therefore the path being used in the example should be "/a/b"
, not "/a/b/c/d"
My suggestion is to change the example to be the following
set(path "/a/b/c")
cmake_path(IS_PREFIX path "/a/b/c/d" result) # result = true
cmake_path(IS_PREFIX path "/a/b" result) # result = false
cmake_path(IS_PREFIX path "/x/y/z" result) # result = false
Here is an screenshot of the entire blurb of the cmake_path.rst that contains the example.