[CMake] What do I need to do to insure that CMake uses gfortran?

Conan dev at celticblues.com
Fri Apr 4 11:03:35 EDT 2014


Yes, I cleared the build directory before each run of cmake.  I 
eventually just added the following lines:

SET (CMAKE_Fortran_COMPILER  gfortran)
SET (CMAKE_CC_COMPILER  gcc)
SET (CMAKE_CXX_COMPILER  g++)

Not sure if that is the "approved" way to do this but that got me back 
on track.

C

On 2014-04-03 15:37, Nils Gladitz wrote:
> On 03.04.2014 23:07, Conan wrote:
>> 
>> I have my env var FC set to /usr/bin/gfortran.  This is verified by 
>> the line MESSAGE("FC = " $ENV{FC}).  However 
>> GET_FILENAME_COMPONENT(Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} 
>> NAME) sets Fortran_COMPILER_NAME to f95.  I thought by setting the FC 
>> env var I could for the use of gfortran.
>> 
>> What do I need to do to insure that CMake uses gfortran?
>> 
> 
> Did you try with a fresh build directory?
> You can not change the compiler once it has been configured.
> CMake only uses the FC environment variable when Fortran is enabled
> for the first time.
> 
> Nils


More information about the CMake mailing list