MantisBT - CMake
View Issue Details
0004773CMakeCMakepublic2007-04-03 12:162008-10-09 19:47
irwin 
Bill Hoffman 
normalmajoralways
closedno change required 
 
 
0004773: CMAKE_BUILD_TYPE does not work correctly for g77
Even if bug 4772 is worked around by specifying Fortran in the PROJECT statement, then the cached Fortran flags I get with Linux/g77 for 2.4.6 are all blanked, e.g.

//Fortran compiler.
CMAKE_Fortran_COMPILER:FILEPATH=/usr/bin/g77

//Flags for Fortran compiler.
CMAKE_Fortran_FLAGS:STRING=' '

//Flags used by the compiler during debug builds.
CMAKE_Fortran_FLAGS_DEBUG:STRING=

//Flags used by the compiler during release minsize builds.
CMAKE_Fortran_FLAGS_MINSIZEREL:STRING=

//Flags used by the compiler during release builds (/MD /Ob1 /Oi
// /Ot /Oy /Gs will produce slightly less optimized but smaller
// files).
CMAKE_Fortran_FLAGS_RELEASE:STRING=

//Flags used by the compiler during Release with Debug Info builds.
//
CMAKE_Fortran_FLAGS_RELWITHDEBINFO:STRING=

These blank flags turn, e.g., -DCMAKE_BUILD_TYPE=Debug into a no-op for g77.

There is a Platform/g77.cmake with all the right g77 flag information, but nothing includes it on Linux which is the source of this bug.

The solution is to INCLUDE g77.cmake every time that gcc.cmake (which sets the appropriate gcc and g++ flags) is INCLUDEd. That can be implemented by putting the following lines at the end of Platform/gcc.cmake:

# always include the gcc compiler information
INCLUDE(Platform/gcc)

N.B. ENABLE_LANGUAGE is broken for Fortran just as it is for C and C++ (see bug 4772) so you must work around that issue by specifying Fortran in
the PROJECT command before the above two-line fix will work.

I have assigned the formal priority for this bug as 3 (should be fixed or added before the final release), but on general principles (deal with the low-hanging fruit first) such simple two-line fixes as above should get your highest priority.
No tags attached.
Issue History
2008-10-09 13:19Bill HoffmanNote Added: 0013809
2008-10-09 17:45irwinNote Added: 0013826
2008-10-09 19:47Bill HoffmanStatusassigned => closed
2008-10-09 19:47Bill HoffmanResolutionopen => no change required

Notes
(0013809)
Bill Hoffman   
2008-10-09 13:19   
Is this still an issue?
(0013826)
irwin   
2008-10-09 17:45   
It is not an issue for gfortran, the fortran compiler that is now distributed by the gcc team as a replacement of g77. I don't know whether it is still an issue for g77 because I don't have access to that any more. But I think that is a common story so you may want to just close this bug due to decreasing access to and interest in g77.