diff options
author | Brad King <brad.king@kitware.com> | 2009-12-14 16:40:23 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-12-14 16:40:23 (GMT) |
commit | 126c93cddae95f46060f6d88af9c92dc6297f88d (patch) | |
tree | af900536800590f565d7ea87a51f17a0d217a64e /Modules/CMakeForceCompiler.cmake | |
parent | f7171e2b764fd85b96c50355d4ce6ffa9a4f4439 (diff) | |
download | CMake-126c93cddae95f46060f6d88af9c92dc6297f88d.zip CMake-126c93cddae95f46060f6d88af9c92dc6297f88d.tar.gz CMake-126c93cddae95f46060f6d88af9c92dc6297f88d.tar.bz2 |
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.
Diffstat (limited to 'Modules/CMakeForceCompiler.cmake')
-rw-r--r-- | Modules/CMakeForceCompiler.cmake | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake index c9793b4..b7a681a 100644 --- a/Modules/CMakeForceCompiler.cmake +++ b/Modules/CMakeForceCompiler.cmake @@ -16,6 +16,13 @@ # It also bypasses the check for working compiler and basic compiler # 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) # SET(CMAKE_SYSTEM_NAME Generic) @@ -60,3 +67,16 @@ MACRO(CMAKE_FORCE_CXX_COMPILER compiler id) SET(CMAKE_COMPILER_IS_GNUCXX 1) 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) |