summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeFortranCompilerABI.F90
diff options
context:
space:
mode:
authorMichael Hirsch <scivision@users.noreply.github.com>2021-06-20 06:56:02 (GMT)
committerBrad King <brad.king@kitware.com>2021-06-25 15:44:05 (GMT)
commit97e2828d14b7afbf4e22a3ea5b4ecf49f1f7c6f2 (patch)
tree8946be5518ddf83deee02570f21b1bc270f688bf /Modules/CMakeFortranCompilerABI.F90
parenta6b075c3f8306a6192e66206252d76e2e5925432 (diff)
downloadCMake-97e2828d14b7afbf4e22a3ea5b4ecf49f1f7c6f2.zip
CMake-97e2828d14b7afbf4e22a3ea5b4ecf49f1f7c6f2.tar.gz
CMake-97e2828d14b7afbf4e22a3ea5b4ecf49f1f7c6f2.tar.bz2
Fortran: Subsume F90 check into ABI check
Follow the approach from commit 1d21dd0f7c (enable_language: Assume compiler works if ABI detection compiles, 2020-05-25, v3.18.0-rc1~93^2) to avoid a redundant check for F90 support. Almost all maintained Fortran compilers support F90 these days. Fixes: #22222
Diffstat (limited to 'Modules/CMakeFortranCompilerABI.F90')
-rw-r--r--Modules/CMakeFortranCompilerABI.F9048
1 files changed, 48 insertions, 0 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