<div dir="ltr">Hi guys,<br><div class="gmail_quote"><div dir="ltr"><div><br>I am currently working on some CMake build scripts that were designed for crossplatform use. However they are not working perfectly under windows.<br><br>The isolated testcase looks like this: initialize a fortran project. CMake always tries to use 'ifort' from Visual Studio as compiler but I do not even have that installed. Instead I want to use gfortran from MingW (which is set in my %PATH% variable).<br><br>The messy (because I tried so much stuff :) CMakeLists.txt looks like this:<br><br><span style="font-family:monospace,monospace">cmake_minimum_required( VERSION 2.8.12 )<br><br>message( "-- env(fc): $ENV{FC}")<br>message( "-- cmake generator fc: ${CMAKE_GENERATOR_FC}")<br><br>set(FC "gfortran" CACHE PATH "" FORCE)<br>set(CMAKE_GENERATOR_FC "gfortran" CACHE PATH "" FORCE)<br>set(CMAKE_Fortran_COMPILER_INIT "gfortran" CACHE PATH "" FORCE)<br>set(CMAKE_Fortran_COMPILER_LIST "gfortran" CACHE PATH "" FORCE)<br>set(ENV{FC} "gfortran" CACHE PATH "" FORCE)<br>set(CMAKE_Fortran_COMPILER "gfortran" CACHE STRING "" FORCE)<br>SET(CMAKE_Fortran_COMPILER_ENV_VAR "FC")<br><br>project( example Fortran )<br><br># why does this always print ifort instead of gfortran?<br>message("-- fortran compiler ${CMAKE_Fortran_COMPILER} ")<br><br>include(CheckLanguage)<br>check_language(Fortran)<br>if(CMAKE_Fortran_COMPILER)<br>   enable_language(Fortran)<br>else()<br>   message(STATUS "No native Fortran support ")<br>endif()</span><br><br>So for me none of these options to switch from ifort to gfortran works. The output is always the same:<br><br><span style="font-family:monospace,monospace">cmake -G "Visual Studio 9 2008" ..<br>-- env(fc):<br>-- cmake generator fc: gfortran<br>-- Check for working Fortran compiler using: Visual Studio 9 2008 -- broken<br>-> fails: "The Fortran compiler ifort is not able to compile a simple test program."</span><br><br>Maybe there is someone around here who can explain this issue to me. The CMake docs can't help me and neither googling for hours.<br><br>Please let me know if you need further system informations.<br><br>Thanks in advance!<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888">- japedo24<br></font></span></div>
</div><br></div>