get_filename_component(...) incorrectly separates pathnames with a trailing /
Found during some testing with CMake 3.12.1. No testing on older versions has been done.
SET(PATH "/bla/")
GET_FILENAME_COMPONENT(_parent "${PATH}" DIRECTORY)
GET_FILENAME_COMPONENT(_name "${PATH}" NAME)
MESSAGE(STATUS "Parts of \"${PATH}\" are \"${_parent}\" and \"${_name}\"")
The expected output of this would be:
Parts of "/bla/" are "/" and "bla"
However, the observed output is:
Parts of "/bla/" are "/" and ""
A current workaround is simple: take the absolute path first and work with that.