summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeTestFortranCompiler.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-07-30 17:46:51 (GMT)
committerBrad King <brad.king@kitware.com>2009-07-30 17:46:51 (GMT)
commit68434483791bb4b1a5b64bcc701cd3625f438eb3 (patch)
tree49e96e2a25ce84b07152fc0da632688cad491845 /Modules/CMakeTestFortranCompiler.cmake
parentfcab87c9f802965318bee033c2fa3ff27cfbfec7 (diff)
downloadCMake-68434483791bb4b1a5b64bcc701cd3625f438eb3.zip
CMake-68434483791bb4b1a5b64bcc701cd3625f438eb3.tar.gz
CMake-68434483791bb4b1a5b64bcc701cd3625f438eb3.tar.bz2
Pass Fortran90 test result to try-compile
This stores CMAKE_Fortran_COMPILER_SUPPORTS_F90 in the Fortran compiler information file CMakeFiles/CMakeFortranCompiler.cmake instead of in CMakeCache.txt. This file makes the result available to try-compile projects.
Diffstat (limited to 'Modules/CMakeTestFortranCompiler.cmake')
-rw-r--r--Modules/CMakeTestFortranCompiler.cmake56
1 files changed, 28 insertions, 28 deletions
diff --git a/Modules/CMakeTestFortranCompiler.cmake b/Modules/CMakeTestFortranCompiler.cmake
index 6591c2d..cb91572 100644
--- a/Modules/CMakeTestFortranCompiler.cmake
+++ b/Modules/CMakeTestFortranCompiler.cmake
@@ -42,6 +42,34 @@ ELSE(NOT CMAKE_Fortran_COMPILER_WORKS)
# Try to identify the ABI and configure it into CMakeFortranCompiler.cmake
INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake)
CMAKE_DETERMINE_COMPILER_ABI(Fortran ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F)
+
+ # Test for Fortran 90 support by using an f90-specific construct.
+ IF(NOT DEFINED CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+ MESSAGE(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90")
+ FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90 "
+ PROGRAM TESTFortran90
+ stop = 1 ; do while ( stop .eq. 0 ) ; end do
+ END PROGRAM TESTFortran90
+")
+ TRY_COMPILE(CMAKE_Fortran_COMPILER_SUPPORTS_F90 ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90
+ OUTPUT_VARIABLE OUTPUT)
+ IF(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+ MESSAGE(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90 -- yes")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the Fortran compiler supports Fortran 90 passed with "
+ "the following output:\n${OUTPUT}\n\n")
+ SET(CMAKE_Fortran_COMPILER_SUPPORTS_F90 1)
+ ELSE(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+ MESSAGE(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90 -- no")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the Fortran compiler supports Fortran 90 failed with "
+ "the following output:\n${OUTPUT}\n\n")
+ SET(CMAKE_Fortran_COMPILER_SUPPORTS_F90 0)
+ ENDIF(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+ UNSET(CMAKE_Fortran_COMPILER_SUPPORTS_F90 CACHE)
+ ENDIF(NOT DEFINED CMAKE_Fortran_COMPILER_SUPPORTS_F90)
+
CONFIGURE_FILE(
${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake
@@ -49,31 +77,3 @@ ELSE(NOT CMAKE_Fortran_COMPILER_WORKS)
)
ENDIF(CMAKE_Fortran_COMPILER_FORCED)
ENDIF(NOT CMAKE_Fortran_COMPILER_WORKS)
-
-IF(CMAKE_Fortran_COMPILER_WORKS)
- # Test for Fortran 90 support by using an f90-specific construct.
- IF(NOT DEFINED CMAKE_Fortran_COMPILER_SUPPORTS_F90)
- MESSAGE(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90")
- FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90 "
- PROGRAM TESTFortran90
- stop = 1 ; do while ( stop .eq. 0 ) ; end do
- END PROGRAM TESTFortran90
- ")
- TRY_COMPILE(CMAKE_Fortran_COMPILER_SUPPORTS_F90 ${CMAKE_BINARY_DIR}
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90
- OUTPUT_VARIABLE OUTPUT)
- IF(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
- MESSAGE(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90 -- yes")
- FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
- "Determining if the Fortran compiler supports Fortran 90 passed with "
- "the following output:\n${OUTPUT}\n\n")
- SET(CMAKE_Fortran_COMPILER_SUPPORTS_F90 1 CACHE INTERNAL "")
- ELSE(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
- MESSAGE(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90 -- no")
- FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
- "Determining if the Fortran compiler supports Fortran 90 failed with "
- "the following output:\n${OUTPUT}\n\n")
- SET(CMAKE_Fortran_COMPILER_SUPPORTS_F90 0 CACHE INTERNAL "")
- ENDIF(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
- ENDIF(NOT DEFINED CMAKE_Fortran_COMPILER_SUPPORTS_F90)
-ENDIF(CMAKE_Fortran_COMPILER_WORKS)