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

Kelly (KT) Thompson kt at transpireinc.com
Fri Oct 30 20:31:32 EDT 2009


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?

My flags.mak has the following (path and file names changed to protect the
innocent):

Fortran_FLAGS = -warn -free -fpp -implicitnone -openmp -mia32 -axSSSE3 -O2
-inline-level=2  -funroll-loops -DNDEBUG -I/path/to/include/dir
-I/path/to/include/dir2

When I run make 'VERBOSE=1', I see:

$ /opt/intel/Compiler/11.1/059/bin/intel64/ifort  -o
CMakeFiles/mydir.dir/myfile.o -warn -free -fpp -implicitnone -openmp -mia32
-axSSSE3 -O2 -inline-level=2  -funroll-loops -DNDEBUG -I/path/to/include/dir
-I/path/to/include/dir2 -c /path/to/src/myfile.F95
ifort: warning #10147: no action performed for specified file(s)

What I need is (added -Tf):

$ /opt/intel/Compiler/11.1/059/bin/intel64/ifort  -o myfile.o -warn -free
-fpp -implicitnone -openmp -mia32 -axSSSE3 -O2 -inline-level=2
-funroll-loops -DNDEBUG -I/path/to/include/dir -I/path/to/include/dir2 -c
-Tf /path/to/src/myfile.F95

How can I obtain this result with CMake?

TIA,

-kt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091030/ae9ea1ce/attachment.htm>


More information about the CMake mailing list