CMake: Let runtime checks through stdout only (#2666)

This avoids mixing emulators errors on stderr to configure results
while cross-compiling with wine.
This commit is contained in:
Julien Schueller 2023-04-11 21:28:32 +02:00 committed by GitHub
parent 3bca79c7aa
commit 70d9616672
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 23 deletions

View File

@ -780,12 +780,17 @@ if (HDF5_BUILD_FORTRAN)
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c
${SOURCE_CODE}
)
if (CMAKE_VERSION VERSION_LESS 3.25)
set (_RUN_OUTPUT_VARIABLE "RUN_OUTPUT_VARIABLE")
else ()
set (_RUN_OUTPUT_VARIABLE "RUN_OUTPUT_STDOUT_VARIABLE")
endif()
TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c
COMPILE_DEFINITIONS "-D_SIZEOF___FLOAT128=${H5_SIZEOF___FLOAT128};-D_HAVE_QUADMATH_H=${H5_HAVE_QUADMATH_H}"
COMPILE_OUTPUT_VARIABLE COMPILEOUT
RUN_OUTPUT_VARIABLE OUTPUT_VAR
${_RUN_OUTPUT_VARIABLE} OUTPUT_VAR
)
set (${RETURN_OUTPUT_VAR} ${OUTPUT_VAR})

View File

@ -39,11 +39,16 @@ macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90
"${SOURCE_CODE}"
)
if (CMAKE_VERSION VERSION_LESS 3.25)
set (_RUN_OUTPUT_VARIABLE "RUN_OUTPUT_VARIABLE")
else ()
set (_RUN_OUTPUT_VARIABLE "RUN_OUTPUT_STDOUT_VARIABLE")
endif()
TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90
LINK_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}"
RUN_OUTPUT_VARIABLE OUTPUT_VAR
${_RUN_OUTPUT_VARIABLE} OUTPUT_VAR
)
set (${RETURN_OUTPUT_VAR} ${OUTPUT_VAR})
@ -169,10 +174,10 @@ foreach (KIND ${VAR})
"
PROGRAM main
USE ISO_C_BINDING
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stdout=>OUTPUT_UNIT
IMPLICIT NONE
INTEGER (KIND=${KIND}) a
WRITE(stderr,'(I0)') ${FC_SIZEOF_A}
WRITE(stdout,'(I0)') ${FC_SIZEOF_A}
END
"
)
@ -210,10 +215,10 @@ foreach (KIND ${VAR} )
"
PROGRAM main
USE ISO_C_BINDING
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stdout=>OUTPUT_UNIT
IMPLICIT NONE
REAL (KIND=${KIND}) a
WRITE(stderr,'(I0)') ${FC_SIZEOF_A}
WRITE(stdout,'(I0)') ${FC_SIZEOF_A}
END
"
)
@ -252,17 +257,17 @@ set (PROG_SRC3
"
PROGRAM main
USE ISO_C_BINDING
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stdout=>OUTPUT_UNIT
IMPLICIT NONE
INTEGER a
REAL b
DOUBLE PRECISION c
WRITE(stderr,*) ${FC_SIZEOF_A}
WRITE(stderr,*) kind(a)
WRITE(stderr,*) ${FC_SIZEOF_B}
WRITE(stderr,*) kind(b)
WRITE(stderr,*) ${FC_SIZEOF_C}
WRITE(stderr,*) kind(c)
WRITE(stdout,*) ${FC_SIZEOF_A}
WRITE(stdout,*) kind(a)
WRITE(stdout,*) ${FC_SIZEOF_B}
WRITE(stdout,*) kind(b)
WRITE(stdout,*) ${FC_SIZEOF_C}
WRITE(stdout,*) kind(c)
END
"
)

View File

@ -82,7 +82,7 @@ END PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE
!---- START ----- Determine the available KINDs for REALs and INTEGERs
PROGRAM FC_AVAIL_KINDS
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stdout=>OUTPUT_UNIT
IMPLICIT NONE
INTEGER :: ik, jk, k, kk, max_decimal_prec
INTEGER :: prev_rkind, num_rkinds = 1, num_ikinds = 1
@ -102,11 +102,11 @@ PROGRAM FC_AVAIL_KINDS
ENDDO
DO k = 1, num_ikinds
WRITE(stderr,'(I0)', ADVANCE='NO') list_ikinds(k)
WRITE(stdout,'(I0)', ADVANCE='NO') list_ikinds(k)
IF(k.NE.num_ikinds)THEN
WRITE(stderr,'(A)',ADVANCE='NO') ','
WRITE(stdout,'(A)',ADVANCE='NO') ','
ELSE
WRITE(stderr,'()')
WRITE(stdout,'()')
ENDIF
ENDDO
@ -139,17 +139,17 @@ PROGRAM FC_AVAIL_KINDS
ENDDO prec
DO k = 1, num_rkinds
WRITE(stderr,'(I0)', ADVANCE='NO') list_rkinds(k)
WRITE(stdout,'(I0)', ADVANCE='NO') list_rkinds(k)
IF(k.NE.num_rkinds)THEN
WRITE(stderr,'(A)',ADVANCE='NO') ','
WRITE(stdout,'(A)',ADVANCE='NO') ','
ELSE
WRITE(stderr,'()')
WRITE(stdout,'()')
ENDIF
ENDDO
WRITE(stderr,'(I0)') max_decimal_prec
WRITE(stderr,'(I0)') num_ikinds
WRITE(stderr,'(I0)') num_rkinds
WRITE(stdout,'(I0)') max_decimal_prec
WRITE(stdout,'(I0)') num_ikinds
WRITE(stdout,'(I0)') num_rkinds
END PROGRAM FC_AVAIL_KINDS
!---- END ----- Determine the available KINDs for REALs and INTEGERs