From c48975f4a9d4b183af3cec014d967063db880c77 Mon Sep 17 00:00:00 2001 From: David Reid Date: Mon, 21 Jul 2025 17:06:34 +1000 Subject: [PATCH] Don't link against dl with NO_RUNTIME_LINKING. --- CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2929fd48..3fda3c47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -450,10 +450,12 @@ endif() set(COMMON_LINK_LIBRARIES) if (UNIX) - # Not all platforms actually use a separate "dl" library, notably NetBSD and OpenBSD. - find_library(LIB_DL "dl") - if(LIB_DL) - list(APPEND COMMON_LINK_LIBRARIES dl) # For dlopen(), etc. Most compilers will link to this by default, but some may not. + if(NOT MINIAUDIO_NO_RUNTIME_LINKING) + # Not all platforms actually use a separate "dl" library, notably NetBSD and OpenBSD. + find_library(LIB_DL "dl") + if(LIB_DL) + list(APPEND COMMON_LINK_LIBRARIES dl) # For dlopen(), etc. Most compilers will link to this by default, but some may not. + endif() endif() list(APPEND COMMON_LINK_LIBRARIES pthread) # Some compilers will not link to pthread by default so list it here just in case.