MantisBT - CMake
View Issue Details
0009241CMakeCMakepublic2009-07-07 15:412009-10-23 08:26
Maik Beckmann 
Brad King 
normalminoralways
closedfixed 
CMake-2-6 
 
0009241: [g95] wrong CMAKE_Fortran_MODDIR_FLAG
if CMAKE_Fortran_MODULE_DIRECTORY is, i.e.

  set(CMAKE_Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/include")

g95 fails with:

  g95: unrecognized option '-J../include'
The proper option is "-fmod=".
No tags attached.
Issue History
2009-07-07 15:41Maik BeckmannNew Issue
2009-07-07 15:44Maik BeckmannNote Added: 0016827
2009-07-07 15:48Maik BeckmannNote Added: 0016828
2009-09-14 13:13Bill HoffmanStatusnew => assigned
2009-09-14 13:13Bill HoffmanAssigned To => Brad King
2009-09-14 17:59Brad KingNote Added: 0017494
2009-09-15 06:34Maik BeckmannNote Added: 0017526
2009-09-15 12:29Brad KingNote Added: 0017537
2009-09-15 12:49Brad KingNote Added: 0017539
2009-09-15 13:03Maik BeckmannNote Added: 0017540
2009-09-16 02:53Maik BeckmannNote Edited: 0017526
2009-10-23 08:26Brad KingNote Added: 0018202
2009-10-23 08:26Brad KingStatusassigned => closed
2009-10-23 08:26Brad KingResolutionopen => fixed

Notes
(0016827)
Maik Beckmann   
2009-07-07 15:44   
The flags for g95: http://www.g95.org/docs.shtml#rung95 [^]
(0016828)
Maik Beckmann   
2009-07-07 15:48   
I tweaked Modules/Platform/Linux-GNU-Fortran.cmake to make it work again

IF(CMAKE_Fortran_COMPILER MATCHES ".*g95")
  SET (CMAKE_Fortran_MODDIR_FLAG -fmod=)
ELSE()
  SET (CMAKE_Fortran_MODDIR_FLAG -J)
ENDIF()

I guess "IF(CMAKE_Fortran_COMPILER MATCHES ".*g95.exe")..." would solve this problem on windows, but I didn't tried it so far.
(0017494)
Brad King   
2009-09-14 17:59   
Does this compiler have a vendor-specific preprocessor id (like __GNUC__ or _MSC_VER)? Is it really GNU?
(0017526)
Maik Beckmann   
2009-09-15 06:34   
(edited on: 2009-09-16 02:53)
<g95 manual>
Predefined Preprocessor Macros
The macros that are always defined are:
__G95__ 0
__G95_MINOR__ 50
__FORTRAN__ 95
__GNUC__ 4
</g95 manual>

So
  #elif defined(__G95__)
is what we want.

This will of course only work, if this statement is listed before
  #elif defined(__GNUC__)
or we rather use
  #elif defined(__GFORTRAN__)
which unfortunately isn't defined before 4.3.0
  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31694 [^]

(0017537)
Brad King   
2009-09-15 12:29   
So the proper compiler id should be "G95"?

Then we can create Compiler/G95-Fortran.cmake to set the moddir flag.
(0017539)
Brad King   
2009-09-15 12:49   
Is g95 command-line compatible with GNU Fortran other than this option?
(0017540)
Maik Beckmann   
2009-09-15 13:03   
My knowledge isn't comprehensive, I just reacted to the moddir problem I ran into.

But addressing this made everything work, so they don't differ in the command line options we use so far.
(0018202)
Brad King   
2009-10-23 08:26   
Test all target types in Fortran
/cvsroot/CMake/CMake/Tests/Fortran/CMakeLists.txt,v <-- Tests/Fortran/CMakeLists.txt
new revision: 1.34; previous revision: 1.33
/cvsroot/CMake/CMake/Tests/Fortran/hello.f,v <-- Tests/Fortran/hello.f
new revision: 1.2; previous revision: 1.1
/cvsroot/CMake/CMake/Tests/Fortran/testf.f,v <-- Tests/Fortran/testf.f
initial revision: 1.1
/cvsroot/CMake/CMake/Tests/Fortran/world.f,v <-- Tests/Fortran/world.f
initial revision: 1.1

Add support for the g95 Fortran compiler
/cvsroot/CMake/CMake/Modules/CMakeFortranCompilerId.F.in,v <-- Modules/CMakeFortranCompilerId.F.in
new revision: 1.5; previous revision: 1.4
/cvsroot/CMake/CMake/Modules/Compiler/G95-Fortran.cmake,v <-- Modules/Compiler/G95-Fortran.cmake
initial revision: 1.1