@@ -219,20 +219,17 @@ int main (void) { return 0; }''')
219219
220220 naev_deps+= blas
221221
222- ### Soft deps (required: false)
223-
224- # libdl can be used for debugging stack traces. On non-Windows platforms, GLAD relies on dlopen().
225- glad_requires_libdl= not cc.has_header(' windows.h' )
226- if glad_requires_libdlor debug
227- # TODO maybe use dependency('dl') instead of find_library. Requires meson 0.62, however.
228- # ref: https://mesonbuild.com/Dependencies.html#dl-libdl
229- libdl= cc.find_library (' dl' ,required :false )
230- if libdl.found()
231- naev_deps+= libdl
232- elif host_machine .system()== ' windows'
233- naev_deps+= subproject (' dlfcn-win32' ).get_variable (' dl_dep' )
234- endif
222+ # libdl can be used for debugging stack traces.
223+ if host_machine .system()== ' windows'
224+ # On non-Windows platforms, GLAD relies on dlopen().
225+ # Windows doesn't have dlopen, but we can use dlfcn-win32 instead.
226+ libdl= dependency (' dl' ,fallback : [' dlfcn-win32' ,' dl_dep' ],required :true )
227+ else
228+ libdl= dependency (' dl' ,required :true )
235229endif
230+ naev_deps+= libdl
231+
232+ ### Soft deps (required: false)
236233
237234if get_option (' debug' )
238235 libbacktrace= cc.find_library (' backtrace' ,has_headers :' backtrace.h' ,required :false )