[CMake] 'MinGW Makefiles' generator can't link when using Intel Fortran

Ben Robinson ben.robinson.msc at gmail.com
Mon Dec 8 14:46:21 EST 2014


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.

Here is my entire top level CMakeLists.txt file:

project(Fortran_1 LANGUAGES Fortran)
cmake_minimum_required(VERSION 3.0)

That's not an excerpt.  :)  I invoke CMake via the following shell command:

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

And I get the following output:

-- The Fortran compiler identification is unknown
-- Check for working Fortran compiler: C:/Program Files
(x86)/Intel/Composer XE 2015/bin/intel64/ifort.exe
-- Check for working Fortran compiler: C:/Program Files
(x86)/Intel/Composer XE 2015/bin/intel64/ifort.exe  -- broken
CMake Error at C:/Program Files
(x86)/CMake/share/cmake-3.0/Modules/CMakeTestFortranCompiler.cmake:54
(message):
  The Fortran compiler "C:/Program Files (x86)/Intel/Composer XE
2015/bin/intel64/ifort.exe" is not able to compile a simple test program.
  It fails with the following output:
   Change Dir: F:/workspaces/cmake_fortran_1/build/Debug/CMakeFiles/CMakeTmp

   Run Build Command:"C:/MinGW/bin/mingw32-make.exe"
  "cmTryCompileExec3922092051/fast"

  C:/MinGW/bin/mingw32-make.exe -f
  CMakeFiles\cmTryCompileExec3922092051.dir\build.make
  CMakeFiles/cmTryCompileExec3922092051.dir/build

  mingw32-make.exe[1]: Entering directory
  'F:/workspaces/cmake_fortran_1/build/Debug/CMakeFiles/CMakeTmp'

  "C:\Program Files (x86)\CMake\bin\cmake.exe" -E cmake_progress_report
  F:\workspaces\cmake_fortran_1\build\Debug\CMakeFiles\CMakeTmp\CMakeFiles 1

  Building Fortran object
  CMakeFiles/cmTryCompileExec3922092051.dir/testFortranCompiler.f.obj

  C:\PROGRA~2\Intel\COMPOS~4\bin\intel64\ifort.exe -c

F:\workspaces\cmake_fortran_1\build\Debug\CMakeFiles\CMakeTmp\testFortranCompiler.f
-o CMakeFiles\cmTryCompileExec3922092051.dir\testFortranCompiler.f.obj

  Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running
on
  Intel(R) 64, Version 15.0.0.108 Build 20140726

  Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

  Linking Fortran executable cmTryCompileExec3922092051.exe

  "C:\Program Files (x86)\CMake\bin\cmake.exe" -E cmake_link_script
CMakeFiles\cmTryCompileExec3922092051.dir\link.txt --verbose=1

  C:\PROGRA~2\Intel\COMPOS~4\bin\intel64\ifort.exe
CMakeFiles/cmTryCompileExec3922092051.dir/testFortranCompiler.f.obj -o
cmTryCompileExec3922092051.exe

  Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running
on
  Intel(R) 64, Version 15.0.0.108 Build 20140726
  Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

  Microsoft (R) Incremental Linker Version 12.00.31101.0
  Copyright (C) Microsoft Corporation.  All rights reserved.

  -out:cmTryCompileExec3922092051.exe
  -subsystem:console

  CMakeFiles/cmTryCompileExec3922092051.dir/testFortranCompiler.f.obj

  LINK : fatal error LNK1104: cannot open file 'ifconsol.lib'

  CMakeFiles\cmTryCompileExec3922092051.dir\build.make:79: recipe for target
  'cmTryCompileExec3922092051.exe' failed

  mingw32-make.exe[1]: *** [cmTryCompileExec3922092051.exe] Error 1104

  mingw32-make.exe[1]: Leaving directory
  'F:/workspaces/cmake_fortran_1/build/Debug/CMakeFiles/CMakeTmp'

  Makefile:117: recipe for target 'cmTryCompileExec3922092051/fast' failed

  mingw32-make.exe: *** [cmTryCompileExec3922092051/fast] Error 2


  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)

-- Configuring incomplete, errors occurred!
See also
"F:/workspaces/cmake_fortran_1/build/Debug/CMakeFiles/CMakeOutput.log".
See also
"F:/workspaces/cmake_fortran_1/build/Debug/CMakeFiles/CMakeError.log".

Anything I should try?

Thank you!

Ben Robinson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141208/0b0d16c4/attachment-0001.html>


More information about the CMake mailing list