I'm configuring some project with CMake. I need to get the path separator (e.g. / or \) into a CMake variable to do something with in, never mind what exactly. How can I do that?
How do I get the system's path separator with CMake
6.3k views Asked by einpoklum At
2
There is no CMake variable for the system's path separator that can directly be used.
But as @vre commented using the
file(TO_NATIVE_PATH)command you could do:If you have complete paths the
$<SHELL_PATH:...>generator expression (CMake version >= 3.4) is very useful: