[CMake] How to prefix fortran source files with special compile flag?

Bill Hoffman bill.hoffman at kitware.com
Fri Oct 30 22:08:19 EDT 2009


Kelly (KT) Thompson wrote:
> Hi,
> 
> I am trying to use Intel ifort on Linux to compile source code that uses 
> the extension .F95.  By default, ifort will not compile files with this 
> extension.  To allow the compilation, the name of the source file must 
> be preceded by -Tf (treat the next option as fortran source). While I 
> know how to modify the Fortran flags, I don't know how to add the '-Tf' 
> flag that is directly in front of the source file name (and after the 
> -c).  Can anyone point me in the right direction?
> 

You could try this:

Edit
/Modules/Platform/Linux-Intel-Fortran.cmake

And add this:

   SET(CMAKE_Fortran_COMPILE_OBJECT
     "<CMAKE_Fortran_COMPILER> -o <OBJECT> <DEFINES> <FLAGS> -c -Tf 
<SOURCE>")

I think that will work.


-Bill


More information about the CMake mailing list