[CMake] Problem with FortranCInterface_VERIFY and the Nag Fortran Compiler

Lori A. Pritchett-Sheats lpritch at lanl.gov
Thu Aug 2 18:03:13 EDT 2012


I've run into a problem using the FortranCInterface_VERIFY macro with 
the Nag Fortran compiler. If the Fortran compiler flags contain the 
'-g90' option, it fails because Nag tries to write a debug file (*.g90) 
to the same directory as the source Fortran file. In most cases, a user 
does not have write permission in the CMake installation location and 
the compile fails. I can not control where Nag writes these debug files.

Suggestions on how to work around this other than skipping this test if 
using Nag with the '-g90' option?

Example CMakeLists.txt file:

cmake_minimum_required(VERSION 2.8)


project(Foo C Fortran)

include(FortranCInterface)
FortranCInterface_VERIFY()


Error Output:
Building Fortran object CMakeFiles/VerifyFortran.dir/VerifyFortran.f.o
<redacted>/nag/5.2.724/bin/nagfor   -g90 
-I<redacted>/foo/CMakeFiles/FortranCInterface/VerifyC    -c 
/opt/packages/cmake/2.8.8/share/cmake-2.8/Modules/FortranCInterface/Verify/VerifyFortran.f 
-o CMakeFiles/VerifyFortran.dir/VerifyFortran.f.o
     NAG Fortran Compiler Release 5.2(724)
     Obsolescent: 
/opt/packages/cmake/2.8.8/share/cmake-2.8/Modules/FortranCInterface/Verify/VerifyFortran.f, 
line 1: Fixed source form
     Fatal Error: 
/opt/packages/cmake/2.8.8/share/cmake-2.8/Modules/FortranCInterface/Verify/VerifyFortran.f: 
Cannot create file 
/opt/packages/cmake/2.8.8/share/cmake-2.8/Modules/FortranCInterface/Verify/VerifyFortran.g90
     gmake[2]: *** [CMakeFiles/VerifyFortran.dir/VerifyFortran.f.o] Error 2
     gmake[2]: Leaving directory 
`<redacted>/foo/CMakeFiles/FortranCInterface/VerifyC'
     gmake[1]: *** [CMakeFiles/VerifyFortran.dir/all] Error 2
     gmake[1]: Leaving directory 
`<redacted>/foo/CMakeFiles/FortranCInterface/VerifyC'
     gmake: *** [all] Error 2


-- 
Lori A. Pritchett-Sheats, PhD.
CCS-2, Computational Physics and Methods
Office: 505-665-6675
Fax: 505-665-4972

Los Alamos National Laboratory
P.O. Box 1663
MS D413
Los Alamos, NM 87544



More information about the CMake mailing list