tests/hdf5: work around some problems
There are two cases that won't work (these are taken from fortran/9
cpp), using gfortran with a non-gcc compiler on windows, or using
gfortran with apple clang. The latter is due to default search paths,
which we can fix, but is out of scope for this MR.
@@ -19,12 +19,27 @@ if add_languages('cpp', required: false)
test('HDF5 C++', execpp, timeout: 30)
endif
+test_fortran = add_languages('fortran', required: false)
+
+if test_fortran
+ cpp = meson.get_compiler('cpp')
+ fc = meson.get_compiler('fortran')
+
+ if host_machine.system() == 'darwin' and cpp.get_id() == 'clang' and fc.get_id() == 'gcc'
+ # Search paths don't work correctly here and -lgfortran doesn't work
+ test_fortran = false
+ elif host_machine.system() == 'windows' and cpp.get_id() != 'gcc' and fc.get_id() == 'gcc'
+ # mixing gfotran with non-gcc doesn't work on windows
+ test_fortran = false
+ endif
+
# --- Fortran tests
-if add_languages('fortran', required: false)
+ if test_fortran
h5f = dependency('hdf5', language : 'fortran', required : false, disabler: true, method : method)
exef = executable('exef', 'main.f90', dependencies : h5f)
test('HDF5 Fortran', exef, timeout: 30)
endif
+endif
# Check we can apply a version constraint
if h5c.version() != 'unknown'
