[CMake] cmake thinks mingw-64 gfortran on Windows is broken
Brad King
brad.king at kitware.com
Mon Mar 12 07:58:25 EDT 2018
On 03/09/2018 07:58 PM, Ondřej Čertík wrote:
> How do I make CMake pass the "Check for working Fortran compiler" phase?
The problem reported in issue 17810 is caused by trying to
enable C with MSVC and Fortran with GNU together at the same
time, e.g. `project(MyProj C Fortran)`. These tools cannot
be used together directly.
The purpose of cmake_add_fortran_subdirectory as described
in the blog post is to avoid enabling Fortran in the main
project. Instead Fortran is only enabled in a separate project
by itself, and the main project gets only C (and CXX).
If you want to use MSVC and Fortran together directly then you
need a Fortran compiler that works with the MSVC binutils. The
Intel Fortran compiler for Windows, a commercial tool, is one
option. There is also https://github.com/flang-compiler/flang,
which is currently maturing.
Alternatively you can use GNU from MinGW for all languages,
e.g. `CC=gcc CXX=g++ FC=gfortran cmake ../src`.
-Brad
More information about the CMake
mailing list