[CMake] F90 and legacy F77

James C. Sutherland James.Sutherland at utah.edu
Thu Aug 20 21:42:00 EDT 2009


All,

Thanks for the many suggestions.  I managed to subdue the one error  
message I got by adding some compiler flags (the --fdefault-real8 did  
the job, although I am not quite sure why because the statement it was  
giving errors on was dealing with integers).

Alin's suggestion of using the "-std=legacy" flag quieted most of the  
warnings.

Thanks again.

James


On Aug 20, 2009, at 12:17 PM, Alin M Elena wrote:

> Hi James,
>
> this is the option of gfortran that you want to look into.
> -std=std
>           Specify the standard to which the program is expected to  
> conform,
> which may be one of f95, f2003, f2008, gnu,
>           or legacy.  The default value for std is gnu, which  
> specifies a
> superset of the Fortran 95 standard that
>           includes all of the extensions supported by GNU Fortran,  
> although
> warnings will be given for obsolete
>           extensions not recommended for use in new code.  The  
> legacy value
> is equivalent but without the warnings for
>           obsolete extensions, and may be useful for old non-standard
> programs.  The f95, f2003 and f2008 values specify
>           strict conformance to the Fortran 95, Fortran 2003 and  
> Fortran 2008
> standards, respectively; errors are given
>           for all extensions beyond the relevant language standard,  
> and
> warnings are given for the Fortran 77 features
>           that are permitted but obsolescent in later standards.
>
>
> A good compiler would select the type of the standard after the  
> extension.
>
> than you should look at this
> set_source_files_properties(${src_dir}/SCF2.f90  PROPERTIES  
> COMPILE_FLAGS
> /Od)
>
> if the code is too old 80's you may deal with pre fortran 77 and  
> other special
> extension that were never part of standard.
>
> Alin
>
> On Wednesday 19 August 2009 01:20:39 cmake-request at cmake.org wrote:
>> Message: 3
>> Date: Tue, 18 Aug 2009 15:39:14 -0600
>> From: "James C. Sutherland" <James.Sutherland at utah.edu>
>> Subject: [CMake] F90 and legacy F77
>> To: cmake Mailing List <cmake at cmake.org>
>> Message-ID: <1896503E-7A81-4517-8BCB-D11AE6DB7D2B at utah.edu>
>> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>>
>> Is there a way to detect and use both F77 and F90 compilers?
>>
>> I have some legacy F77 code that uses constructs that have been
>> deprecated/removed in F90.  I would like to compile those F77 files
>> with a F77 compiler, compile the F90 files with an F90 compiler, and
>> then link them with the F90 compiler.
>>
>> How can this be done with CMake?
>>
>> For example:
>>        foo.f   <-- F77 file
>>        bar.f90  <-- F90 file
>>
>> I want something equivalent to
>>        g77 foo.f -o foo.o
>>        gfotran bar.f90 foo.o -o executable.x
>
> -- 
>   
> ______________________________________________________________________
>  Without Questions there are no Answers!
>   
> ______________________________________________________________________
>  Mr  Alin M ELENA
>  Irish Centre for High-End Computing -- www.ichec.ie
>  The Design Tower, Trinity Technology & Enterprise Campus
>  Grand Canal Quay,  Dublin 2, Ireland
>  Tel:   +353 (0) 1 5241608 ext 29
>  Fax: +353 (0) 1 7645845
>  http://alin.elenaworld.net
>  alin.elena at ichec.ie
>  alinm.elena at gmail.com
>   
> ______________________________________________________________________
>
> -- 
>   
> ______________________________________________________________________
>  Without Questions there are no Answers!
>   
> ______________________________________________________________________
>  Mr  Alin M ELENA
>  Irish Centre for High-End Computing -- www.ichec.ie
>  The Design Tower, Trinity Technology & Enterprise Campus
>  Grand Canal Quay,  Dublin 2, Ireland
>  Tel:   +353 (0) 1 5241608 ext 29
>  Fax: +353 (0) 1 7645845
>  http://alin.elenaworld.net
>  alin.elena at ichec.ie
>  alinm.elena at gmail.com
>   
> ______________________________________________________________________



More information about the CMake mailing list