-if ((NOT DEFINED enable_smpi OR enable_smpi) AND NOT APPLE) # 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)
- 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)
+if ((NOT DEFINED enable_smpi) OR enable_smpi)
+ # First unset the compiler in case we're re-running cmake over a previous
+ # configuration where it was saved as smpiff
+ unset(CMAKE_Fortran_COMPILER)
+
+ SET(SMPI_FORTRAN 0)
+ if(enable_fortran)
+ enable_language(Fortran OPTIONAL)