diff options
-rw-r--r-- | Modules/CMakeFortranCompilerABI.F90 | 48 | ||||
-rw-r--r-- | Modules/CMakeTestFortranCompiler.cmake | 9 |
2 files changed, 56 insertions, 1 deletions
diff --git a/Modules/CMakeFortranCompilerABI.F90 b/Modules/CMakeFortranCompilerABI.F90 new file mode 100644 index 0000000..4a17153 --- /dev/null +++ b/Modules/CMakeFortranCompilerABI.F90 @@ -0,0 +1,48 @@ +program CMakeFortranCompilerABI + +implicit none + +integer :: i(1) = 0 +where (i==0) i=1 +if (any(i/=1)) stop 1 +! showing Fortran 90 syntax is OK + +#if 0 +! Address Size +#endif +#if defined(_LP64) +PRINT *, 'INFO:sizeof_dptr[8]' +#elif defined(_M_IA64) +PRINT *, 'INFO:sizeof_dptr[8]' +#elif defined(_M_X64) +PRINT *, 'INFO:sizeof_dptr[8]' +#elif defined(_M_AMD64) +PRINT *, 'INFO:sizeof_dptr[8]' +#elif defined(__x86_64__) +PRINT *, 'INFO:sizeof_dptr[8]' + +#elif defined(_ILP32) +PRINT *, 'INFO:sizeof_dptr[4]' +#elif defined(_M_IX86) +PRINT *, 'INFO:sizeof_dptr[4]' +#elif defined(__i386__) +PRINT *, 'INFO:sizeof_dptr[4]' + +#elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 8 +PRINT *, 'INFO:sizeof_dptr[8]' +#elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 4 +PRINT *, 'INFO:sizeof_dptr[4]' +#elif defined(__SIZEOF_SIZE_T__) && __SIZEOF_SIZE_T__ == 8 +PRINT *, 'INFO:sizeof_dptr[8]' +#elif defined(__SIZEOF_SIZE_T__) && __SIZEOF_SIZE_T__ == 4 +PRINT *, 'INFO:sizeof_dptr[4]' +#endif + +#if 0 +! Application Binary Interface +#endif +#if defined(__ELF__) +PRINT *, 'INFO:abi[ELF]' +#endif +PRINT *, 'ABI Detection' +end program diff --git a/Modules/CMakeTestFortranCompiler.cmake b/Modules/CMakeTestFortranCompiler.cmake index 10fb0a7..4fdec94 100644 --- a/Modules/CMakeTestFortranCompiler.cmake +++ b/Modules/CMakeTestFortranCompiler.cmake @@ -17,11 +17,18 @@ unset(CMAKE_Fortran_COMPILER_WORKS CACHE) # 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) +CMAKE_DETERMINE_COMPILER_ABI(Fortran ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F90) if(CMAKE_Fortran_ABI_COMPILED) # The compiler worked so skip dedicated test below. set(CMAKE_Fortran_COMPILER_WORKS TRUE) + set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 1) message(STATUS "Check for working Fortran compiler: ${CMAKE_Fortran_COMPILER} - skipped") +else() + cmake_determine_compiler_abi(Fortran ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F) + if(CMAKE_Fortran_ABI_COMPILED) + set(CMAKE_Fortran_COMPILER_WORKS TRUE) + message(STATUS "Check for working Fortran 77 compiler: ${CMAKE_Fortran_COMPILER} - skipped") + endif() endif() # This file is used by EnableLanguage in cmGlobalGenerator to |