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.