Compiler program installed in Windows cannot recognize file path generated by Cmake in Cygwin.

Environment description:

  • Cmake and Ninja installed in Cygwin
  • Compiler program (like mingw-gcc) installed in Windows

When I use cmake in cygwin to build a project, it will go error when running try-compile project for detecting compiler ABI info and features. The error log says the compiler cannot open source file.

I found it is caused by the source file path format. As camke is installed in cygwin, when build a project, it will generate files with path in cygwin format (like /cygdrive/e/home/user/path/to/project), but the compiler is installed in Windows, it can only recognize file path in Windows format (like E:/home/user/path/to/project).

Is there any methods to fix this error?

You cannot mix cygwin and non-cygwin programs if file paths are involved. Choose one or the other.

We have been able to use cygwin with the ARM mingw base compilers
there have been issues with cmake not using the the @ response files (there are workarounds for that) and some path work to allow /cydrive/c and /c to work transparently. (e.g. in cygwin bash, mkdir -p /cygdrive/c/cygdrive/c and create native symlinks or junctions in that directory to where the files really are )

also some work must be done to clean up the dependency paths generated from the mingw compilers

( just noticed you were using ninja, and we are using unix makefiles, but I think some of this may apply )