From: Arnaud Giersch Date: Mon, 29 Oct 2012 10:39:17 +0000 (+0100) Subject: Force Fortran compiler name, before calling enable_language(Fortran). X-Git-Tag: v3_9_rc1~91^2~154^2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/8828a2eccd298da736f32c7c4b3528d8ea29b3a5?hp=0fe4ab7fd44958740d4c5fc70f072ee9ac606015 Force Fortran compiler name, before calling enable_language(Fortran). Fix commit 95cd71e835559251f778c5e3676a49e881172ba6, avoiding unnecessary cmake runs. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index e1f960b865..b0a1e69eb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,13 +7,15 @@ 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) +if (NOT DEFINED enable_smpi OR enable_smpi) # smpi is enabled by default + # Call enable_language(Fortran) in order to load the build rules for + # this language, needed by teshsuite/smpi/mpich-test/. Use + # CMAKE_FORCE_Fortran_COMPILER to bypass checks for a working + # compiler (smpiff don't exist at configure time). + include(CMakeForceCompiler) + CMAKE_FORCE_Fortran_COMPILER(smpiff smpiff) + enable_language(Fortran OPTIONAL) endif() -enable_language(Fortran OPTIONAL) set(CMAKE_C_FLAGS "" CACHE TYPE INTERNAL FORCE) set(CMAKE_CXX_FLAGS "" CACHE TYPE INTERNAL FORCE)