Is there a "$/", an easy "path-separator" variable?

Definitively, to avoid any trouble about escaping, especially when you pass variable contents to commands, it is strongly recommended to use exclusively the slash as path separator.

Moreover, to be complete, file(TO_NATIVE_PATH) is now superseded by cmake_path command.
This command offers wide possibilities to deal with paths. For example, to compute a path from fragments:

cmake_path(APPEND DESTINATION_DIR "${CMAKE_CURRENT_LIST_DIR}" ".." "bin")
1 Like