MantisBT - CMake
View Issue Details
0015684CMakeCMakepublic2015-08-05 07:332016-01-04 11:52
Raul Laasner 
Brad King 
lowminoralways
closedfixed 
LinuxArch Linux
CMake 3.3 
CMake 3.3.1CMake 3.3.1 
0015684: CMAKE_Fortran_COMPILER_VERSION becomes unset after second configuring
CMAKE_Fortran_COMPILER_VERSION contains the correct version after the first configuring (first run of cmake), but becomes undefined after the second configuring. Is this normal behavior?
Try, e.g.,

  message("test 1 " ${CMAKE_C_COMPILER_VERSION})
  message("test 2 " ${CMAKE_Fortran_COMPILER_VERSION})

The first time it prints

  test 1 5.2.0
  test 2 5.2.0

in my system, but after the second run of cmake it prints

  test 1 5.2.0
  test 2
No tags attached.
Issue History
2015-08-05 07:33Raul LaasnerNew Issue
2015-08-05 10:09Kelly ThompsonNote Added: 0039239
2015-08-05 10:42Brad KingAssigned To => Brad King
2015-08-05 10:42Brad KingStatusnew => assigned
2015-08-05 10:42Brad KingTarget Version => CMake 3.3.1
2015-08-05 10:45Brad KingNote Added: 0039240
2015-08-05 10:45Brad KingStatusassigned => resolved
2015-08-05 10:45Brad KingResolutionopen => fixed
2015-08-05 10:45Brad KingFixed in Version => CMake 3.3.1
2016-01-04 11:52Robert MaynardNote Added: 0040106
2016-01-04 11:52Robert MaynardStatusresolved => closed

Notes
(0039239)
Kelly Thompson   
2015-08-05 10:09   
I can reproduce this behavior for the Makefile Generator on RHEL6:
- with gcc and gfortran 4.8.1
- with icc and ifort 15.0.3

A possible workaround is to add a set command immediately after the project command:

project( myCF90project Fortran C )
set( CMAKE_Fortran_COMPILER_VERSION ${CMAKE_Fortran_COMPILER_VERSION} CACHE STRING "Fortran compiler version string" FORCE )
(0039240)
Brad King   
2015-08-05 10:45   
Fixed:

 Fortran: Store detected compiler version persistently
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f0609182 [^]

I've queued this for merge to the 'release' branch for inclusion in 3.3.1.
(0040106)
Robert Maynard   
2016-01-04 11:52   
Closing resolved issues that have not been updated in more than 4 months.