cmake_path(GET in PARENT_PATH out) trailing slash
When using cmake_path(GET in PARENT_PATH out) to manipulate paths in CMake, be cautious about trailing slashes. The usual intent is to get the parent directory of a given path. If the trailing slash is not stripped, the same directory is returned, which may be unexpected.
Strip the trailing slash first like:
set(p "/path/to/directory/")
# Strip trailing slash
string(REGEX REPLACE "[\\/]+$" "" p "${p}")
cmake_path(GET p FILENAME n)