Hi guys,

I am currently working on some CMake build scripts that were designed for
crossplatform use. However they are not working perfectly under windows.

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).

The messy (because I tried so much stuff :) CMakeLists.txt looks like this:

cmake_minimum_required( VERSION 2.8.12 )

message( "-- env(fc): $ENV{FC}")
message( "-- cmake generator fc: ${CMAKE_GENERATOR_FC}")

set(FC "gfortran" CACHE PATH "" FORCE)
set(CMAKE_GENERATOR_FC "gfortran" CACHE PATH "" FORCE)
set(CMAKE_Fortran_COMPILER_INIT "gfortran" CACHE PATH "" FORCE)
set(CMAKE_Fortran_COMPILER_LIST "gfortran" CACHE PATH "" FORCE)
set(ENV{FC} "gfortran" CACHE PATH "" FORCE)
set(CMAKE_Fortran_COMPILER "gfortran" CACHE STRING "" FORCE)
SET(CMAKE_Fortran_COMPILER_ENV_VAR "FC")

project( example Fortran )

# why does this always print ifort instead of gfortran?
message("-- fortran compiler ${CMAKE_Fortran_COMPILER} ")

include(CheckLanguage)
check_language(Fortran)
if(CMAKE_Fortran_COMPILER)
   enable_language(Fortran)
else()
   message(STATUS "No native Fortran support ")
endif()

So for me none of these options to switch from ifort to gfortran works. The
output is always the same:

cmake -G "Visual Studio 9 2008" ..
-- env(fc):
-- cmake generator fc: gfortran
-- Check for working Fortran compiler using: Visual Studio 9 2008 -- broken
-> fails: "The Fortran compiler ifort is not able to compile a simple test
program."

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.

Please let me know if you need further system informations.

Thanks in advance!

- japedo24
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to