From: Arnaud Giersch Date: Sat, 27 Oct 2012 17:39:57 +0000 (+0200) Subject: Optionally look for a Fortran compiler. X-Git-Tag: v3_9_rc1~91^2~159 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/95cd71e835559251f778c5e3676a49e881172ba6 Optionally look for a Fortran compiler. Without that, CMake complains that it "cannot determine link language" for Fortran targets. This is not perfect: cmake is run systematically when doing make :( --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e9a8daf42..e1f960b865 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,13 @@ project(SimGrid C) if (enable_gtnets OR enable_ns3) enable_language(CXX) endif() +# Workaround for a bug in cmake where enable_language does not work +# well with OPTIONAL. +# See http://www.cmake.org/Bug/print_bug_page.php?bug_id=9220 +if(DEFINED CMAKE_Fortran_COMPILER AND CMAKE_Fortran_COMPILER MATCHES "^$") + set(CMAKE_Fortran_COMPILER CMAKE_Fortran_COMPILER-NOTFOUND) +endif() +enable_language(Fortran OPTIONAL) set(CMAKE_C_FLAGS "" CACHE TYPE INTERNAL FORCE) set(CMAKE_CXX_FLAGS "" CACHE TYPE INTERNAL FORCE) diff --git a/buildtools/Cmake/PrintArgs.cmake b/buildtools/Cmake/PrintArgs.cmake index 8d501419c9..a6fd758539 100644 --- a/buildtools/Cmake/PrintArgs.cmake +++ b/buildtools/Cmake/PrintArgs.cmake @@ -85,6 +85,10 @@ if(CMAKE_CXX_COMPILER) message(" Compiler: C++ .......: ${CMAKE_CXX_COMPILER}") message(" version .....: ${COMPILER_CXX_VERSION}") endif() +if(CMAKE_Fortran_COMPILER) + message(" Compiler: Fortran ...: ${CMAKE_Fortran_COMPILER}") + message(" version .....: ${COMPILER_Fortran_VERSION}") +endif() message(" Linker: .............: ${CMAKE_LINKER}") message("") message(" CFlags ..............: ${CMAKE_C_FLAGS}")