[CMake] Installing compiled fortran *.mod files

Kelly Thompson kgt at lanl.gov
Tue May 11 10:11:36 EDT 2010


John,

 

I'm not aware of any 'out of the box' way to install .mod files.  Here's
what I did for my project:

 

First, I wrote a set of macros that would determine the how FC names module
files (evidently there is no standard naming scheme) by using the
try_compile() macro.    Next, I created a macro that would take a list of
Fortran sources and return a list of 'predicted' module file names based on
the naming scheme discovered in step 1.  Once I had the list of module file
names, I could use the standard install() command to place them in the
correct target location.

 

BTW - I have seen the following naming schemes for module files:

 

! File:moduleSRCFILE.f90

module moduleNAME

  integer :: j

end module moduleNAME

 

can produce module files with any of the following names:

 

        modulename.mod  # module name, all lower case

        moduleNAME.mod  # module name, preserve case

        MODULENAME.mod  # module name, all upper case

        Modulename.mod  # module name, capitalize first letter

        modulesrcfile.mod   # file name, all lowercase

        Modulesrcfile.mod   # file name, capitalize first letter

        moduleSRCFILE.mod   # file name, preserve case

        MODULESRCFILE.mod   # file name, all caps

        moduleNAME.o    # module name, .o extension, preserve case

        modulename.o    # module name, .o extension, all lower case

        MODULENAME.o    # module name, .o extension, all upper case

 

In my experience, modern Fortran compilers (gfortran/Linux, ifort/Linux,
ifort/Windows) only use the first case (mod file is the name of the module,
all lower case).  

 

I have hope that someone on this list has a better answer for you because I
would really like to replace my "not-ready-for-primetime" macros.  However,
if anyone is curious, I can tar up my files and email them to you. 

 

-kt

 

From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of
Biddiscombe, John A.
Sent: Tuesday, May 11, 2010 5:54 AM
To: cmake at cmake.org
Subject: [CMake] Installing compiled fortran *.mod files

 

I can't seem to find a way of installing the compiled mod files from a mixed
fortran/C/C++ project (on windows and linux).

 

I can see all the mod files in ${CMAKE_Fortran_MODULE_DIRECTORY}, but
various attempts to install them after compilation fail.

 

My closest effort looks something like this

 

INSTALL (

CODE

"EXECUTE_PROCESS (COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_Fortran_MODULE_DIRECTORY}/${CMAKE_CFG_INTDIR}
${CMAKE_INSTALL_PREFIX}/fortran)"

)

 

but cmake dies on make install with 

>CMake Error: cmake version 2.8.0

6>Usage: C:/Program Files/cmake-2.8.0/bin/cmake.exe -E [command] [arguments
...]

6>Available commands: .....lots of the usaul stuff.

 

Is there a way that works 'out of the box'

 

Thanks

 

JB

 

 

 

 

-- 

John Biddiscombe,                            email:biddisco @ cscs.ch

http://www.cscs.ch/

CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07

Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100511/753afe4e/attachment-0001.htm>


More information about the CMake mailing list