[CMake] Cygwin drive paths are killing me

Nils Gladitz nilsgladitz at gmail.com
Wed Jun 11 09:29:44 EDT 2014


On 11.06.2014 15:25, Eric Wing wrote:
> I am currently in this unholy trinity of needing to use Android on
> Windows through Cygwin.
> Basically, the Android NDK requires Cygwin if you want to run it on
> Windows. I'm using my fork of the Android-CMake toolchain originally
> from OpenCV and trying to generate "Unix Makefiles" with CMake. I
> provide a -C initial_cache list to try to pre-populate my dependency
> list since this is a cross-compile.
>
> This is really ugly stuff. I thought I was on the verge of finally
> getting it working, but I keep bouncing back and forth between file
> path problems:
>
> - Cygwin returns absolute paths like /cygdrive/c/Program Files (x86)
> - But CMake can't seem to resolve the /cygdrive/c part and when trying
> to access files in this form, it fails with 'file not found'
>
> If I change the representation to:
> C:\Program Files (x86), then a lot of CMake functions seem to get
> confused by the backslashes because they are escape sequences in
> strings.
>
> I figured out I can use forward slashes,
> C:/Program Files (x86)
> which helps the problem a little bit.
>
> But sometimes when I change strings to make CMake happy, then if it
> gets passed back to Cygwin to invoke some process, Cygwin dies.
>
> I've been slowly going case by case to use one or the other. I finally
> got my Makefiles generated. But now I gave the problem that the
> Makefiles contain the C:\ form to get past CMake's problems. But when
> I invoke make, Cygwin chokes with
> *** target pattern contains no `%'
> I think this is because of the colon characters in the make file from
> the drive letters.
>
>
> Also, I think there is a bug. CMake thinks strings like C:/Program
> Files (x86) are relative paths, not absolute. Calling file(string ...)
> keeps turning the path I pass into a relative path and prepends a full
> relative path which makes the string turn into complete nonsense (I
> get to drive letter markers in the string).
>
>
> Anyway, am I overlooking something? I know Cygwin is supposed to work.
> How am I supposed to deal with the /cygdrive/c vs C:\ and colon issue?
>
> Thanks,
> Eric


There are cygwin specific builds of cmake (I assume build with the 
cygwin runtime).
Are you using a cygwin specific build or a native windows build of cmake?

Nils


More information about the CMake mailing list