[CMake] Fortran 90 module support for Pathscale-3.2

Michael Wild themiwi at gmail.com
Wed Jan 13 04:28:14 EST 2010


On 12. Jan, 2010, at 18:32 , K. Noel Belcourt wrote:

> Hi,
> 
> I've started running nightly cmake tests and submitting them to your dashboard.  I was hoping the nightly tests would pick up this problem I'm having.  When compiling Fortran90 code with pathscale-3.2 (pathf90), I get this error.
> 
> 	pathf90 ERROR parsing -J../module: unknown flag
> 
> It seems this is set in this file.
> 
> 	./Modules/Platform/Linux-GNU-Fortran.cmake:SET(CMAKE_Fortran_MODDIR_FLAG -J)
> 
> But -J isn't common to all Fortran90 compilers (though it works fine for gfortran).  Is there a way to generalize this and add a test that will exercise this capability?
> 
> -- Noel

This IS the generalization. The file Linux-GNU-Fortran.cmake is specific to GNU Fortran and sets the variable CMAKE_Fortran_MODDIR_FLAG which then is used in other places. So, you need to teach CMake to treat your compiler not as GNU Fortran and set the correct flags for it.

First, look through Modules/CMakeDetermineFortranCompiler.cmake. AFAIK it is enough to add the compilers to the list CMAKE_Fortran_COMPILER_LIST and add a variable _Fortran_COMPILER_NAMES_PathScale also listing the compiler names.

Then you need to modify Modules/CMakeFortranCompilerId.F.in to do the actual detection based on the characteristic preprocessor symbols defined by the compiler.

Finally you'll need to set all the required variables in Modules/Compiler/PathScale-Fortran.cmake.
If you need to do platform specific stuff (e.g. the flags have different names on Linux than they have on Windows), create as needed:

Modules/Platform/Linux-PathScale-Fortran.cmake
Modules/Platform/Windows-PathScale-Fortran.cmake
Modules/Platform/Darwin-PathScale-Fortran.cmake
Modules/Platform/AIX-PathScale-Fortran.cmake
...


Michael




More information about the CMake mailing list