From ba84e61a184cf041a639a67f72c6c618e57f09e8 Mon Sep 17 00:00:00 2001 From: David Reid Date: Wed, 20 Aug 2025 18:03:12 +1000 Subject: [PATCH] Try fixing a compilation error when libatomic does not exist. --- CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d2c897c0..fe03ce64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -452,9 +452,9 @@ set(COMMON_LINK_LIBRARIES) if (UNIX) if(NOT MINIAUDIO_NO_RUNTIME_LINKING) # Not all platforms actually use a separate "dl" library, notably NetBSD and OpenBSD. - find_library(LIB_DL "dl") + find_library(LIB_DL NAMES 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. + list(APPEND COMMON_LINK_LIBRARIES ${LIB_DL}) # For dlopen(), etc. Most compilers will link to this by default, but some may not. endif() endif() @@ -463,7 +463,10 @@ if (UNIX) # If we're compiling for 32-bit ARM we need to link to -latomic. if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") - list(APPEND COMMON_LINK_LIBRARIES atomic) + find_library(LIB_ATOMIC NAMES atomic) + if(LIB_ATOMIC) + list(APPEND COMMON_LINK_LIBRARIES ${LIB_ATOMIC}) + endif() endif() endif()