CMake: Improve handling of dl.

This commit is contained in:
David Reid
2025-07-15 08:12:36 +10:00
parent a4072246c5
commit 51715474d7
+3 -1
View File
@@ -457,7 +457,9 @@ endif()
set(COMMON_LINK_LIBRARIES) set(COMMON_LINK_LIBRARIES)
if (UNIX) if (UNIX)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "NetBSD") # 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. list(APPEND COMMON_LINK_LIBRARIES dl) # For dlopen(), etc. Most compilers will link to this by default, but some may not.
endif() endif()