# [CMake] Cmake path separators - Unix/Windows ?

Alexander Neundorf a.neundorf-work at gmx.net
Wed Nov 14 18:02:00 EST 2007

On Wednesday 14 November 2007, Stephen Collyer wrote:
> It's not clear to me how Cmake handle / and \ path separators.
> Some of the Find modules have explicit Windows style paths
> interspersed with Unix style paths, whereas others have Unix
> style paths only. I can't find anything in the man page or
> wiki that refers to this. I'm guessing that:
>
> a) relative paths are handled correctly on both Unix and Windows
> platforms, and are automatically used on both platforms e.g.
>
> foo/bar
>
> is used relative to some appropriate Cmake variable on both
> Windows and Unix
>
> b) absolute paths are used only on the platform to which they
> are native e.g.
>
> /foo/bar is Unix only
> c:\foo\bar is Windows only
>
> Is that right ?

In cmake files paths should always have forward slashes /, e.g. "c:/foo/"
and "/usr/bin". If they come from the outside, they should be converted using
FILE(TO_CMAKE_PATH).

Alex