[CMake] cmake thinks mingw-64 gfortran on Windows is broken

Ondřej Čertík ondrej at certik.us
Fri Mar 9 19:58:42 EST 2018


Hi,

I have previously reported the issue here:

https://gitlab.kitware.com/cmake/cmake/issues/17810

I was told to follow https://blog.kitware.com/fortran-for-cc-developers-made-easier-with-cmake/. I did in fact follow it. Just to be sure, I tried the `-DCMAKE_GNUtoMS=ON -DBUILD_SHARED_LIBS=ON` with no difference.

The problem is already at the "Check for working Fortran compiler" phase. As described in the issue above, CMake is trying to use gfortran for linking and passes incorrect options to it.

My understanding is that on Windows, one must use gfortran to build a dll, and then dynamically link it with MSVC, with the proper cmake options like `-DCMAKE_GNUtoMS=ON -DBUILD_SHARED_LIBS=ON`. However, this can only be done once the "Check for working Fortran compiler" phase passes.

How do I make CMake pass the "Check for working Fortran compiler" phase?

Thanks,
Ondrej


More information about the CMake mailing list