Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Define macro if it's missing.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Mon, 12 Nov 2012 17:05:26 +0000 (18:05 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Mon, 12 Nov 2012 17:06:51 +0000 (18:06 +0100)
CMAKE_FORCE_Fortran_COMPILER does not exist with cmake before 2.8.1.
See http://www.cmake.org/Bug/view.php?id=10032

CMakeLists.txt

index b0a1e69..ad5b8da 100644 (file)
@@ -13,6 +13,20 @@ if (NOT DEFINED enable_smpi OR enable_smpi) # smpi is enabled by default
   # CMAKE_FORCE_Fortran_COMPILER to bypass checks for a working
   # compiler (smpiff don't exist at configure time).
   include(CMakeForceCompiler)
+  if(NOT COMMAND CMAKE_FORCE_Fortran_COMPILER)
+    MACRO(CMAKE_FORCE_Fortran_COMPILER compiler id)
+      SET(CMAKE_Fortran_COMPILER "${compiler}")
+      SET(CMAKE_Fortran_COMPILER_ID_RUN TRUE)
+      SET(CMAKE_Fortran_COMPILER_ID ${id})
+      SET(CMAKE_Fortran_COMPILER_WORKS TRUE)
+      SET(CMAKE_Fortran_COMPILER_FORCED TRUE)
+
+      # Set old compiler id variables.
+      IF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
+        SET(CMAKE_COMPILER_IS_GNUG77 1)
+      ENDIF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
+    ENDMACRO(CMAKE_FORCE_Fortran_COMPILER)
+  endif()
   CMAKE_FORCE_Fortran_COMPILER(smpiff smpiff)
   enable_language(Fortran OPTIONAL)
 endif()