Skip to content

Commit 5ab73c1

Browse files
committed
meson: also have libdl
1 parent a5ba45f commit 5ab73c1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

cmake/meson.build

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ endif
1818
#== find HDF5
1919

2020
# needed for HDF5 on some systems including Ubuntu
21-
threads = dependency('threads')
21+
threads = dependency('threads', required: false)
22+
dl = fc.find_library('dl', required: false)
2223

2324
use_static = get_option('default_library') == 'static'
25+
# NOTE: static: parameter is too strict for now. Works more reliably without this parameter
2426

25-
hdf5 = dependency('hdf5', language : 'fortran', required: false, disabler: true, static: use_static)
27+
hdf5 = dependency('hdf5', language : 'fortran', required: false, disabler: true) # , static: use_static
2628
if fc.links('use h5lt; end', dependencies: hdf5, name: 'HDF5')
2729
h5incdir = []
28-
hdf5 = [hdf5, threads]
30+
hdf5 = [hdf5, threads, dl]
2931
subdir_done()
3032
endif
3133

@@ -54,7 +56,7 @@ hdf5_libs = []
5456
foreach name : ['hdf5', 'hdf5_fortran', 'hdf5_hl', 'hdf5_hl_fortran', # msys2 names
5557
'hdf5_serial', 'hdf5_serial_fortran',
5658
'hdf5_serial_hl', 'hdf5_serialhl_fortran']
57-
lib = fc.find_library(name, required: false, dirs: h5libdir, static: use_static)
59+
lib = fc.find_library(name, required: false, dirs: h5libdir) # , static: use_static
5860
if lib.found()
5961
hdf5_libs += lib
6062
endif
@@ -64,5 +66,5 @@ endforeach
6466
if not fc.links('use h5lt; end', dependencies: hdf5_libs, include_directories: h5incdir, name: 'HDF5')
6567
hdf5 = disabler()
6668
else
67-
hdf5 = declare_dependency(dependencies: [hdf5_libs, threads], include_directories: h5incdir)
69+
hdf5 = declare_dependency(dependencies: [hdf5_libs, threads, dl], include_directories: h5incdir)
6870
endif

0 commit comments

Comments
 (0)