Fortran: Detect pointer size in gfortran on MinGW

Use __SIZEOF_POINTER__ which the GNU Fortran compiler defines at least
on 64-bit MinGW.  Assume default size 4 on MinGW if gfortran does not
define the size.
This commit is contained in:
Brad King 2011-11-29 15:13:47 -05:00
parent 89f6fbaae3
commit ecd8414757
3 changed files with 10 additions and 0 deletions

View File

@ -57,6 +57,8 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src)
IF(ABI_SIZEOF_DPTR) IF(ABI_SIZEOF_DPTR)
SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${ABI_SIZEOF_DPTR}" PARENT_SCOPE) SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${ABI_SIZEOF_DPTR}" PARENT_SCOPE)
ELSEIF(CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT)
SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT}" PARENT_SCOPE)
ENDIF(ABI_SIZEOF_DPTR) ENDIF(ABI_SIZEOF_DPTR)
IF(ABI_NAME) IF(ABI_NAME)

View File

@ -15,6 +15,11 @@
PRINT *, 'INFO:sizeof_dptr[4]' PRINT *, 'INFO:sizeof_dptr[4]'
#elif defined(_M_IX86) #elif defined(_M_IX86)
PRINT *, 'INFO:sizeof_dptr[4]' 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]'
#endif #endif
#if 0 #if 0

View File

@ -1,2 +1,5 @@
include(Platform/Windows-GNU) include(Platform/Windows-GNU)
__windows_compiler_gnu(Fortran) __windows_compiler_gnu(Fortran)
# gfortran on 64-bit MinGW defines __SIZEOF_POINTER__
set(CMAKE_Fortran_SIZEOF_DATA_PTR_DEFAULT 4)