title: How can I get a basic Fortran file to compile on Windows/MinGW using CMake?
body: <p>I feel completely lost trying to get CMake to work on Windows.  I have a project (<a href="https://software.ecmwf.int/wiki/display/ECC/Releases" rel="nofollow">ECCODES</a>) that has Fortran and C files.  I can compile Fortran files if I don't use CMake.  But this project came with a ton of CMake files.  I look at the error below and it says to me, "<em>I (CMake) cannot compile a simple Fortran program even though you can compile Fortran files when you aren't using CMake."</em>  Can anyone make sense of this?  I'm trying to use mingw64 since I can't use cygwin on this project for the Windows build.  On Mac OS X and GNU/Linux everything builds fine, but I have to run this project on Windows...</p>
  
  <pre><code>Error:The Fortran compiler "c:/gcc-5.1.0-tdm64-1-fortran/bin/gfortran.exe" is not able to compile a simple test program.
  It fails with the following output:
   Change Dir: C:/Users/knauthg/.CLion2016.1/system/cmake/generated/ECCodes-45f4e5f3/45f4e5f3/__default__/CMakeFiles/CMakeTmp
  Run Build Command:"C:/mingw64/bin/mingw32-make.exe" "cmTC_93cb8/fast"
  C:/mingw64/bin/mingw32-make.exe -f CMakeFiles\cmTC_93cb8.dir\build.make CMakeFiles/cmTC_93cb8.dir/build
  mingw32-make.exe[1]: Entering directory 'C:/Users/knauthg/.CLion2016.1/system/cmake/generated/ECCodes-45f4e5f3/45f4e5f3/__default__/CMakeFiles/CMakeTmp'
  Building Fortran object CMakeFiles/cmTC_93cb8.dir/testFortranCompiler.f.obj
  c:\gcc-5.1.0-tdm64-1-fortran\bin\gfortran.exe -c C:\Users\knauthg\.CLion2016.1\system\cmake\generated\ECCodes-45f4e5f3\45f4e5f3\__default__\CMakeFiles\CMakeTmp\testFortranCompiler.f -o CMakeFiles\cmTC_93cb8.dir\testFortranCompiler.f.obj
  CMakeFiles\cmTC_93cb8.dir\build.make:64: recipe for target 'CMakeFiles/cmTC_93cb8.dir/testFortranCompiler.f.obj' failed
  mingw32-make.exe[1]: *** [CMakeFiles/cmTC_93cb8.dir/testFortranCompiler.f.obj] Error 1
  mingw32-make.exe[1]: Leaving directory 'C:/Users/knauthg/.CLion2016.1/system/cmake/generated/ECCodes-45f4e5f3/45f4e5f3/__default__/CMakeFiles/CMakeTmp'
  Makefile:125: recipe for target 'cmTC_93cb8/fast' failed
  mingw32-make.exe: *** [cmTC_93cb8/fast] Error 2
  CMake will not be able to correctly generate this project.
  </code></pre>