[Cmake-commits] [cmake-commits] king committed CMakeForceCompiler.cmake 1.10 1.11

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Dec 14 11:40:25 EST 2009


Update of /cvsroot/CMake/CMake/Modules
In directory public:/mounts/ram/cvs-serv31855/Modules

Modified Files:
	CMakeForceCompiler.cmake 
Log Message:
Provide macro to force Fortran compiler

We add the macro CMAKE_FORCE_Fortran_COMPILER to the cross-compiling
helper module CMakeForceCompiler.cmake so that toolchain files can force
a Fortran compiler as well as C and C++ compilers.  See issue #10032.


Index: CMakeForceCompiler.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeForceCompiler.cmake,v
retrieving revision 1.10
retrieving revision 1.11
diff -C 2 -d -r1.10 -r1.11
*** CMakeForceCompiler.cmake	28 Sep 2009 15:46:50 -0000	1.10
--- CMakeForceCompiler.cmake	14 Dec 2009 16:40:23 -0000	1.11
***************
*** 17,20 ****
--- 17,27 ----
  # information tests.
  #
+ # Macro CMAKE_FORCE_Fortran_COMPILER has the following signature:
+ #   CMAKE_FORCE_Fortran_COMPILER(<compiler> <compiler-id>)
+ # It sets CMAKE_Fortran_COMPILER to the given compiler and the cmake
+ # internal variable CMAKE_Fortran_COMPILER_ID to the given compiler-id.
+ # It also bypasses the check for working compiler and basic compiler
+ # information tests.
+ #
  # So a simple toolchain file could look like this:
  #   INCLUDE (CMakeForceCompiler)
***************
*** 61,62 ****
--- 68,82 ----
    ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
  ENDMACRO(CMAKE_FORCE_CXX_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)



More information about the Cmake-commits mailing list