[CMake] Three problems with cmake under windows

Jack Kelly endgame.dos at gmail.com
Tue Jun 5 18:31:06 EDT 2007


lucatrv wrote:
>>> 2) Since I have two fortran compilers installed, sometimes I chose to 
>>> use gfortran and sometimes ifort.
>>> However, If I use the following commands in this order:
>>> PROJECT (hello Fortran)
>>> SET (CMAKE_Fortran_COMPILER gfortran)
>>> cmake still tests ifort working when creating the makefile.
>>> The only whay to have cmake make use only of gfortran is to use the 
>>> commands in the following order:
>>> SET (CMAKE_Fortran_COMPILER gfortran)
>>> PROJECT (hello Fortran)
>>> I think it would be better that cmake set the right compiler also in 
>>> the first case, also because the required order is not specified in 
>>> the cmake documentation.
>>>
>> You can not set the compiler like that.   You have to set the 
>> environment variable FC before you run cmake.  There has been a 
>> request to add a way to do this from CMakeSetup, but it has not yet 
>> been implemented.

Would "cmake -DCMAKE_Fortran_COMPILER:string=/path/to/gfortran" work? I 
know it works for setting CMAKE_C_COMPILER for small MinGW test programs 
on Linux, but I'm not sure about the general case.

-- Jack


More information about the CMake mailing list