With CMP0037 OLD behavior, executable and library target names may contain a slash. Avoid constructing file names with slashes. Fixes: #19653