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.
This commit is contained in:
parent
fcab87c9f8
commit
6843448379
|
@ -15,6 +15,8 @@ ENDIF(CMAKE_COMPILER_IS_CYGWIN)
|
|||
|
||||
SET(CMAKE_Fortran_COMPILER_ENV_VAR "FC")
|
||||
|
||||
SET(CMAKE_Fortran_COMPILER_SUPPORTS_F90 @CMAKE_Fortran_COMPILER_SUPPORTS_F90@)
|
||||
|
||||
IF(CMAKE_COMPILER_IS_MINGW)
|
||||
SET(MINGW 1)
|
||||
ENDIF(CMAKE_COMPILER_IS_MINGW)
|
||||
|
|
|
@ -42,15 +42,7 @@ 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)
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake
|
||||
@ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
|
||||
)
|
||||
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")
|
||||
|
@ -58,7 +50,7 @@ IF(CMAKE_Fortran_COMPILER_WORKS)
|
|||
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)
|
||||
|
@ -67,13 +59,21 @@ IF(CMAKE_Fortran_COMPILER_WORKS)
|
|||
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 "")
|
||||
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 CACHE INTERNAL "")
|
||||
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)
|
||||
ENDIF(CMAKE_Fortran_COMPILER_WORKS)
|
||||
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake
|
||||
@ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
|
||||
)
|
||||
ENDIF(CMAKE_Fortran_COMPILER_FORCED)
|
||||
ENDIF(NOT CMAKE_Fortran_COMPILER_WORKS)
|
||||
|
|
Loading…
Reference in New Issue