CMake Intel Fortran Compiler 無法彌閒簡單的程序



我正在使用CMake在Windows下准备一个Fortran项目。我已经使用VC2015安装了一些入口Fortran编译器,当我cmake出现以下错误时

-- Check for working Fortran compiler: D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/ifc.exe
-- Check for working Fortran compiler: D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/ifc.exe  -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/CMakeTestFortranCompiler.cmake:54 (message):
  The Fortran compiler "D:/Program Files (x86)/Microsoft Visual Studio
  14.0/VC/bin/ifc.exe" is not able to compile a simple test program.
  It fails with the following output:
   Change Dir: D:/Dev/plaf/build/CMakeFiles/CMakeTmp
  Run Build Command:"nmake" "/NOLOGO" "cmTC_f7da8fast"
        "D:Program Files (x86)Microsoft Visual Studio 14.0VCBINnmake.exe" -f
  CMakeFilescmTC_f7da8.dirbuild.make /nologo -L
  CMakeFilescmTC_f7da8.dirbuild
  Building Fortran object
  CMakeFiles/cmTC_f7da8.dir/testFortranCompiler.f.obj
        "D:Program Files (x86)Microsoft Visual Studio 14.0VCbinifc.exe" -c
  D:DevplafbuildCMakeFilesCMakeTmptestFortranCompiler.f -o
  CMakeFilescmTC_f7da8.dirtestFortranCompiler.f.obj
  usage: D:Program Files (x86)Microsoft Visual Studio 14.0VCbinifc.exe
  [subcommand] [options...]
    subcommands:
      OBJ            Convert an interface file into a dummy object file which can be archived into a static lib.
      EMBED          Embed an interface file into an existing static lib, producing a new lib.
      EXTRACT        Extract an embedded interface file from an existing static lib, producing the ifc.
      LOCATE         Find all embedded interface files and print their offset + size to stdout.
  NMAKE : fatal error U1077: '"D:Program Files (x86)Microsoft Visual Studio
  14.0VCbinifc.exe"' : return code '0x1'

我对错误的理解(如果我错了,请纠正我),是 cmake 使用了带有错误标志的编译器,因此在示例程序编译期间它不起作用。

我该如何解决这个问题?(该错误似乎与我在大多数其他帖子中看到的不同)

当我

使用 MinGW 编译时,它是由我发生的。解决方案是在CMake的配置中选择"MinGW Makefiles"而不是Visual Studio

最新更新