<div dir="ltr"><span style="font-size:13px">I am having trouble getting a CMake to compile Fortran on Windows.  I have mingw32-make.exe in my path.  I have the Intel Fortran compile ifort.exe in my path.  If I choose the 'Visual Studio 11 2012' generator, Fortran is properly detected and the project sets up fine.  I am willing to use a different Makefiles generator, provided I can also compile C++ with Visual Studio compiler in a Makefiles based build.</span><div style="font-size:13px"><br></div><div style="font-size:13px">Here is my entire top level CMakeLists.txt file:<div><br></div><div><div>project(Fortran_1 LANGUAGES Fortran)</div><div>cmake_minimum_required(VERSION 3.0)</div><div><br></div><div>That's not an excerpt.  :)  I invoke CMake via the following shell command:</div><div><br></div><div>F:\workspaces\cmake_fortran_1\build\Debug> cmake -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -DOUTPUT_DIR=F:\workspaces\cmake_fortran_1\build\ F:\workspaces\cmake_fortran_1\source</div><div><br></div><div>And I get the following output:</div><div><br></div><div><div>-- The Fortran compiler identification is unknown</div><div>-- Check for working Fortran compiler: C:/Program Files (x86)/Intel/Composer XE 2015/bin/intel64/ifort.exe</div><div>-- Check for working Fortran compiler: C:/Program Files (x86)/Intel/Composer XE 2015/bin/intel64/ifort.exe  -- broken</div><div>CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.0/Modules/CMakeTestFortranCompiler.cmake:54 (message):</div><div>  The Fortran compiler "C:/Program Files (x86)/Intel/Composer XE 2015/bin/intel64/ifort.exe" is not able to compile a simple test program.</div><div>  It fails with the following output:</div><div>   Change Dir: F:/workspaces/cmake_fortran_1/build/Debug/CMakeFiles/CMakeTmp</div><div><br></div><div>   Run Build Command:"C:/MinGW/bin/mingw32-make.exe"</div><div>  "cmTryCompileExec3922092051/fast"</div><div><br></div><div>  C:/MinGW/bin/mingw32-make.exe -f</div><div>  CMakeFiles\cmTryCompileExec3922092051.dir\build.make</div><div>  CMakeFiles/cmTryCompileExec3922092051.dir/build</div><div><br></div><div>  mingw32-make.exe[1]: Entering directory</div><div>  'F:/workspaces/cmake_fortran_1/build/Debug/CMakeFiles/CMakeTmp'</div><div><br></div><div>  "C:\Program Files (x86)\CMake\bin\cmake.exe" -E cmake_progress_report</div><div>  F:\workspaces\cmake_fortran_1\build\Debug\CMakeFiles\CMakeTmp\CMakeFiles 1</div><div><br></div><div>  Building Fortran object</div><div>  CMakeFiles/cmTryCompileExec3922092051.dir/testFortranCompiler.f.obj</div><div><br></div><div>  C:\PROGRA~2\Intel\COMPOS~4\bin\intel64\ifort.exe -c</div><div>  F:\workspaces\cmake_fortran_1\build\Debug\CMakeFiles\CMakeTmp\testFortranCompiler.f -o CMakeFiles\cmTryCompileExec3922092051.dir\testFortranCompiler.f.obj</div><div><br></div><div>  Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on</div><div>  Intel(R) 64, Version 15.0.0.108 Build 20140726</div><div><br></div><div>  Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.</div><div><br></div><div>  Linking Fortran executable cmTryCompileExec3922092051.exe</div><div><br></div><div>  "C:\Program Files (x86)\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTryCompileExec3922092051.dir\link.txt --verbose=1</div><div><br></div><div>  C:\PROGRA~2\Intel\COMPOS~4\bin\intel64\ifort.exe CMakeFiles/cmTryCompileExec3922092051.dir/testFortranCompiler.f.obj -o cmTryCompileExec3922092051.exe</div><div><br></div><div>  Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on</div><div>  Intel(R) 64, Version 15.0.0.108 Build 20140726</div><div>  Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.</div><div><br></div><div>  Microsoft (R) Incremental Linker Version 12.00.31101.0</div><div>  Copyright (C) Microsoft Corporation.  All rights reserved.</div><div><br></div><div>  -out:cmTryCompileExec3922092051.exe</div><div>  -subsystem:console</div><div><br></div><div>  CMakeFiles/cmTryCompileExec3922092051.dir/testFortranCompiler.f.obj</div><div><br></div><div>  LINK : fatal error LNK1104: cannot open file 'ifconsol.lib'</div><div><br></div><div>  CMakeFiles\cmTryCompileExec3922092051.dir\build.make:79: recipe for target</div><div>  'cmTryCompileExec3922092051.exe' failed</div><div><br></div><div>  mingw32-make.exe[1]: *** [cmTryCompileExec3922092051.exe] Error 1104</div><div><br></div><div>  mingw32-make.exe[1]: Leaving directory</div><div>  'F:/workspaces/cmake_fortran_1/build/Debug/CMakeFiles/CMakeTmp'</div><div><br></div><div>  Makefile:117: recipe for target 'cmTryCompileExec3922092051/fast' failed</div><div><br></div><div>  mingw32-make.exe: *** [cmTryCompileExec3922092051/fast] Error 2</div><div><br></div><div><br></div><div>  CMake will not be able to correctly generate this project.</div><div>Call Stack (most recent call first):</div><div>  CMakeLists.txt:1 (project)</div><div><br></div><div>-- Configuring incomplete, errors occurred!</div><div>See also "F:/workspaces/cmake_fortran_1/build/Debug/CMakeFiles/CMakeOutput.log".</div><div>See also "F:/workspaces/cmake_fortran_1/build/Debug/CMakeFiles/CMakeError.log".</div></div></div><div><br></div></div><div style="font-size:13px">Anything I should try?</div><div style="font-size:13px"><br></div><div style="font-size:13px">Thank you!</div><div style="font-size:13px"><br></div><div style="font-size:13px">Ben Robinson</div></div>