[CMake] Cmake path separators - Unix/Windows ?

Pau Garcia i Quiles pgquiles at elpauer.org
Wed Nov 14 18:01:17 EST 2007


Quoting Stephen Collyer <scollyer at netspinner.co.uk>:

> 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 ?

Actually, c:/foo/bar would work on Windows. The key here is the  
"root": / in Unix, C: in Windows. Using FILE(TO_NATIVE_PATH path  
result) helps, too.

-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)



More information about the CMake mailing list