summaryrefslogtreecommitdiffstats
path: root/config/cmake
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-06-04 02:56:43 (GMT)
committerGitHub <noreply@github.com>2021-06-04 02:56:43 (GMT)
commit9041351328a4f0c806da56653c3c8abdda2ad222 (patch)
tree47345eb59a8d22a18b118bbe2c3b779f3be2599c /config/cmake
parent032310b87f5b5a118b3206de9565f153062b8b78 (diff)
downloadhdf5-9041351328a4f0c806da56653c3c8abdda2ad222.zip
hdf5-9041351328a4f0c806da56653c3c8abdda2ad222.tar.gz
hdf5-9041351328a4f0c806da56653c3c8abdda2ad222.tar.bz2
Fixes issue with ccmake that prevents building Fortran (#723)
ccmake runs iteratively, and the check_fortran_source_runs macros were clobbering a single output file that did not get updated on further configure iterations
Diffstat (limited to 'config/cmake')
-rw-r--r--config/cmake/HDF5UseFortran.cmake76
1 files changed, 7 insertions, 69 deletions
diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake
index 003f24f..67f47ec 100644
--- a/config/cmake/HDF5UseFortran.cmake
+++ b/config/cmake/HDF5UseFortran.cmake
@@ -129,74 +129,12 @@ endif ()
# Determine the available KINDs for REALs and INTEGERs
#-----------------------------------------------------------------------------
-#READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" SOURCE_CODE)
-set (PROG_SRC_CODE
- "
- PROGRAM FC_AVAIL_KINDS
- IMPLICIT NONE
- INTEGER :: ik, jk, k, max_decimal_prec
- INTEGER :: num_rkinds = 1, num_ikinds = 1
- INTEGER, DIMENSION(1:10) :: list_ikinds = -1
- INTEGER, DIMENSION(1:10) :: list_rkinds = -1
-
- OPEN(8, FILE='pac_fconftest.out', FORM='formatted')
-
- ! Find integer KINDs
- list_ikinds(num_ikinds)=SELECTED_INT_KIND(1)
- DO ik = 2, 36
- k = SELECTED_INT_KIND(ik)
- IF(k.LT.0) EXIT
- IF(k.GT.list_ikinds(num_ikinds))THEN
- num_ikinds = num_ikinds + 1
- list_ikinds(num_ikinds) = k
- ENDIF
- ENDDO
-
- DO k = 1, num_ikinds
- WRITE(8,'(I0)', ADVANCE='NO') list_ikinds(k)
- IF(k.NE.num_ikinds)THEN
- WRITE(8,'(A)',ADVANCE='NO') ','
- ELSE
- WRITE(8,'()')
- ENDIF
- ENDDO
-
- ! Find real KINDs
- list_rkinds(num_rkinds)=SELECTED_REAL_KIND(1)
- max_decimal_prec = 1
-
- prec: DO ik = 2, 36
- exp: DO jk = 1, 17000
- k = SELECTED_REAL_KIND(ik,jk)
- IF(k.LT.0) EXIT exp
- IF(k.GT.list_rkinds(num_rkinds))THEN
- num_rkinds = num_rkinds + 1
- list_rkinds(num_rkinds) = k
- ENDIF
- max_decimal_prec = ik
- ENDDO exp
- ENDDO prec
-
- DO k = 1, num_rkinds
- WRITE(8,'(I0)', ADVANCE='NO') list_rkinds(k)
- IF(k.NE.num_rkinds)THEN
- WRITE(8,'(A)',ADVANCE='NO') ','
- ELSE
- WRITE(8,'()')
- ENDIF
- ENDDO
-
- WRITE(8,'(I0)') max_decimal_prec
- WRITE(8,'(I0)') num_ikinds
- WRITE(8,'(I0)') num_rkinds
- END PROGRAM FC_AVAIL_KINDS
- "
-)
+READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" SOURCE_CODE)
if (NOT CMAKE_VERSION VERSION_LESS "3.14.0")
- check_fortran_source_runs (${PROG_SRC_CODE} FC_AVAIL_KINDS_RESULT SRC_EXT f90)
+ check_fortran_source_runs (${SOURCE_CODE} FC_AVAIL_KINDS_RESULT SRC_EXT f90)
else ()
FORTRAN_RUN ("REAL and INTEGER KINDs"
- "${PROG_SRC_CODE}"
+ "${SOURCE_CODE}"
XX
YY
FC_AVAIL_KINDS_RESULT
@@ -260,7 +198,7 @@ foreach (KIND ${VAR})
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER (KIND=${KIND}) a
- OPEN(8,FILE='pac_validIntKinds.out',FORM='formatted')
+ OPEN(8,FILE='pac_validIntKinds.${KIND}.out',FORM='formatted')
WRITE(8,'(I0)') ${FC_SIZEOF_A}
CLOSE(8)
END
@@ -271,7 +209,7 @@ foreach (KIND ${VAR})
else ()
FORTRAN_RUN("INTEGER KIND SIZEOF" ${PROG_SRC_${KIND}} XX YY VALIDINTKINDS_RESULT_${KIND})
endif ()
- file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_validIntKinds.out" PROG_OUTPUT1)
+ file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_validIntKinds.${KIND}.out" PROG_OUTPUT1)
string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}")
set (pack_int_sizeof "${pack_int_sizeof} ${PROG_OUTPUT1},")
endforeach ()
@@ -309,7 +247,7 @@ foreach (KIND ${VAR} )
USE ISO_C_BINDING
IMPLICIT NONE
REAL (KIND=${KIND}) a
- OPEN(8,FILE='pac_validRealKinds.out',FORM='formatted')
+ OPEN(8,FILE='pac_validRealKinds.${KIND}.out',FORM='formatted')
WRITE(8,'(I0)') ${FC_SIZEOF_A}
CLOSE(8)
END
@@ -320,7 +258,7 @@ foreach (KIND ${VAR} )
else ()
FORTRAN_RUN ("REAL KIND SIZEOF" ${PROG_SRC2_${KIND}} XX YY VALIDREALKINDS_RESULT_${KIND})
endif ()
- file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_validRealKinds.out" PROG_OUTPUT1)
+ file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_validRealKinds.${KIND}.out" PROG_OUTPUT1)
string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}")
set (pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT1},")
endforeach ()