[CMake] MSVC 2005 and Intel Visual Fortran 10

Kelly (KT) Thompson kt at transpireinc.com
Fri Apr 4 17:11:22 EDT 2008


I've spent the last few days trying to convince CMake to configure a
toy FORTRAN project without success.  I'm hoping that someone on this
list can point me in the right direction.  Here are the details:

System setup:
Windows XP
Microsoft Visual Studio 8 2005
Intel Visual Fortran 10.1.014
CMake 2.4.8 (also playing with the 2.6 beta -- but I'm having the same
difficulties).

Project files:
<file=foo.f90>
program foo
   print *, "Hello"
end program foo
</file>

<file=CMakeLists.txt>
project( project_foo )
enable_language( Fortran )
add_executable( foo foo.f90 )
</file>

Case 1: Generator "NMake Makefiles" works!

Open command window for "Intel Visual Fortran Compiler..."
cmake -G"NMake Makefiles" (everything is okay)
nmake (everything is okay)
Good.

Case 2: Generator "Visual Studio 8 2005" fails.

Open command window for "Intel Visual Fortran Compiler..."
(erase all cache files, etc.)
cmake -G"Visual Studio 8 2005"
-- Check for working C compiler: C:/Program Files (x86)/Microsoft
Visual Studio 8/VC/bin/x86_amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft
Visual Studio 8/VC/bin/x86_amd64/cl.exe -- works
-- Check size of void*
-- Check size of void* - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft
Visual Studio 8/VC/bin/x86_amd64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft
Visual Studio 8/VC/bin/x86_amd64/cl.exe -- works
Processing Windows-ifort.cmake
CMakeTestFortranCompiler.cmake
-- Check for working Fortran compiler: C:/Program Files
(x86)/Intel/Compiler/Fortran/10.1.014/em64t/bin/ifort.exe
Processing Windows-ifort.cmake
-- Check for working Fortran compiler: C:/Program Files
(x86)/Intel/Compiler/Fortran/10.1.014/em64t/bin/ifort.exe -- broken
CMake Error: The Fortran compiler "C:/Program Files
(x86)/Intel/Compiler/Fortran/10.1.014/em64t/bin/ifort.exe" is not able
to compile a simple test program.
It fails with the following output:

Microsoft (R) Visual Studio Version 8.0.50727.42.
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
1>------ Build started: Project: cmTryCompileExec, Configuration:
Debug Win32 ------
1>Building Fortran object testFortranCompiler.obj
1>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version
14.00.50727.42 for 80x86
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>usage: cl [ option... ] filename... [ /link linkoption... ]
1>Linking Fortran target cmTryCompileExec.exe
1>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version
14.00.50727.42 for 80x86
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>usage: cl [ option... ] filename... [ /link linkoption... ]
1>ipo: error #11035: Fatal error cannot open ifconsol
1>ifort: error #10014: problem during multi-file optimization
compilation (code 1)
1>Project : error PRJ0019: A tool returned an error code from "Linking
Fortran target cmTryCompileExec.exe"
1>Build log was saved at
"file://c:\a\b\vs8\CMakeFiles\CMakeTmp\cmTryCompileExec.dir\Debug\BuildLog.htm"
1>cmTryCompileExec - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========


Now, I really would like to be able to create a MSVC/IVF project, but
I don't know what to do next.  So, I tried the --debug-trycompile
CMake option.  Here's where things start to get interesting:

Case 2.A.

I can cut and past the ifort commands out of
CMakeFiles\CMakeTmp\cmTryCompileExec.dir\Debug\BuildLog.htm back to my
cmd window.  In this environment, these FORTRAN compile commands will
compile the test code.  This leads me to believe that there is an
environment issue.

Case 2.B.

I can load the "left-over" .sln or .vcproj files (left by
--debug-trycompile) into MSVC 2005.  These projects fail to compile
with the same ifconsol error.
However, if I load the these files by running "devenv /useenv
CMAKE_TRY_COMPILE.sln," the projects are able to compile the FORTRAN
code.  Again, this appears to be an environment issue.

Finally, my question to you is:

How do I tell CMake to use my local environment?
or
How do I manually set the CMake/MSVC/IVF environment to allow CMake to
configure such a project?

I have already tried setting all ifortvars.bat variables directly in
my windows environment, but this doesn't appear to help anything.

Another item of interest is that away from CMake, IntelVisualFortran
likes to create and use .vfproj files (analogous to MSVC's .vcproj
files).  Is CMake suppose to create such a file for me?

Thanks for any help or information.

-kt


More information about the CMake mailing list